[Scilab-users] Reading a matrix - variable number of lines, columns
I have a file with different matrices inside. This matrices have a line with a certain keyword before the data.
I can read the data with the following code if I have nlat rows and 5 columns.
fid=mopen(datafile,'r'); // open the file for reading
//Skip data till the data part:
while(strcmp(line, " Avg Num Sensors: ")~=0)
//Read the data
ANSR=mfscanf(nlat,fid,'%f %f %f %f %f ');
My problem is the following: I searched but I didn't find a way to make the number of columns a variable.
I tried to read the data line by line and wanted to use msscanf to scan the string but that didn't work.
In the following example I tried to analyze 5 values of the string line but it didn't work.