From: dpb on
Matteo wrote:
> I am a beginner user. Any help with this would be greatly appreciated.
>
....
>
> 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);

My guess is that you're not accounting that the file pointer isn't moved
from one call to textscan to the next so you're skipping lines from the
last location read rather than from the first this way.

Why not simply read each group the same way since it appears that's regular?

--