0
votes

I have a '.ismr' file which I am able to open with fopen. The file has several columns (but I am interested in first 9 of them) and several rows. On of the rows is:

1655, 60.00, 12, 00A00000, 184.25, 21.92, 42.02, 0.099385, 0.079280,

After opening the file, I am using tline to read one line at a time and then using textscan as follows:

xyz = textscan(tline,'%f, %f, %f, %s %f, %f, %f, %f, %f,');

When I run my script, it only gives me first three readings from the row correctly (i.e. 1655,60.00 and 12) but from 4th onwards, I am not getting anything or just garbage.

Please help me to correct my script. Thanks

1

1 Answers

1
votes

Why not just use comma as your delimiter, rather than putting it into the format?

xyz = textscan(tline,'%f%f%f%s%f%f%f%f%f','Delimiter',',');

Note that you can use textscan directly on the file to read multiple rows with the same format, you don't need to read the line in before processing it.