Prev: output selected number of rows of a sparse matrix to a text file?
Next: how to use textscan in a for loop with header lines increasingat each iteration
From: Matteo on 1 Mar 2010 14:17 I am a beginner user. Any help with this would be greatly appreciated. I am given an ascii text dump from a service company. The file contains 176 vectors with 501 samples each in this nasty format: Header 1 - vector 1 samples 1 through 10 samples 11 through 20 .... samples 491 through 500 sample 501 Header 2 - vector 2 samples 1 through 10 samples 11 through 20 .... samples 491 through 500 sample 501 .... .... Header 176 - vector 176 samples 1 through 10 samples 11 through 20 .... samples 491 through 500 sample 501 I would like to use textscan, rather than cleaning it up in excel, However, my for loop below returns a cell with empty matrices. I think my syntax is incorrect but I do not get an error message. for k=1:176 n(k)=k+50*(k-1) %test(:,:,k)=textscan(fid,'%f32',501,'headerlines',n); end What I am trying to accomplish is to automate this below: c1=textscan(fid,'%f32',501,'headerlines',1); c2=textscan(fid,'%f32',501,'headerlines',52); .... .... c176=textscan(fid,'%f32',501,'headerlines',8926); Thank you. |