From: nedo nodo on
Hi,

I have a "malformed" text file: it is similar to a file .CSV, but Matlab can't read it automatically.
I have tried a lot of Matlab functions importdata, fopen, textscan etc. but I can't read the file

this is a subsection of the file
[code]
Forward
Packet,Sequence,Time stamp,Delta (ms),Jitter (ms),Skew(ms),IP BW (kbps),Marker,Status
976,61063,0,0.00,0.00,0.00,10.18,,[ Ok ],02/15/2010 14:58:29.639,1286
977,61064,0,0.26,0.02,-0.26,21.04,,[ Ok ],02/15/2010 14:58:29.639,1372
978,61065,0,0.23,0.03,-0.49,26.94,SET,Incorrect timestamp,02/15/2010 14:58:29.639,752
1004,61066,249000,212.21,159.68,2553.96,32.44,SET,[ Ok ],02/15/2010 14:58:29.852,701
[/code]
Matlab code

[code]
fid = fopen('h263w.txt','r');

InputText=textscan(fid,'%s',2,'delimiter','\n'); % Read strings delimited by a carriage return

format = '%f %f %f %f %f %f %f %s %s %f %f';

i=1; % Initialize block index
while (i ~=10) % For each block...

A = textscan(fid, format, 'delimiter',',')
for j=1:7
data(i,j) = A(1,j);
end


i=i+1;
end
fclose(fid);

[/code]I would like to get a Nx7 matrix where N is the number of rows of the file and the columns are 7.
The code read well only the first line of values...Can you help me?