Page 1 of 1

import matrix from file

Posted: Thu Aug 28, 2014 11:44 pm
by figoyouwei
Dear Ted,

The traditional way to import matrix data from file is to 1. define a matrix and then 2. scanf the file by specifying the number of rows and cols, e.g.

Code: Select all

mat = new Matrix(nrow, ncol)
mat.scanf(fileobj, nrow, nrow)
Is there a way in hoc, which can automatically read in the nrow/ncol information from the file without specifying all the times ?

Re: import matrix from file

Posted: Fri Aug 29, 2014 11:20 am
by ted
Let me refer you to the Programmer's Reference documentation of the Matrix class and its methods, where you will find the answer to your question. See the "Programmer's Reference" link on NEURON's home page

Re: import matrix from file

Posted: Tue Sep 02, 2014 3:19 am
by figoyouwei
thanks ! scanf() with no arguments works perfect.