From: Frank on
Dear all,

I need your help to read a unfriendly formatted ascii file which contains some data I have to analyze. The file looks like the following (delimiter is a number of blank spaces not tab):

header 1
header 2
....
header N

10:39 data11 data12 data13 data14
data11 data12 data13 data14
data11 data12 data13 data14
data11 data12 data13 data14
10:40 data11 data12 data13 data14
data11 data12 data13 data14
data11 data12 data13 data14
data11 data12 data13 data14
10:50 data11 data12 data13 data14
data11 data12 data13 data14
data11 data12 data13 data14
data11 data12 data13 data14
....

and so on. If I use the
[a,b,c,d,e,f] = textread('complete data\Track A.txt','%s %f %f %f %f %f','headerlines',8);
I get something weird because when in the first column there is a data everything is almost fine, but when there is not, all the data in the output variables are shifted by one position, the last being set to 0.

Any help would be welcome!

Best regards

Frank
From: dpb on
Frank wrote:
....
> ... The file looks like the following
> (delimiter is a number of blank spaces not tab):
>
> header 1
> header 2
> ...
> header N
>
> 10:39 data11 data12 data13 data14
> data11 data12 data13 data14
> data11 data12 data13 data14
> data11 data12 data13 data14
> 10:40 data11 data12 data13 data14
> data11 data12 data13 data14
> data11 data12 data13 data14
> data11 data12 data13 data14
> ...
>
> and so on. If I use the
> [a,b,c,d,e,f] = textread('complete data\Track A.txt','%s %f %f %f %f
> %f','headerlines',8);
> I get something weird because when in the first column there is a data
> everything is almost fine, but when there is not, all the data in the
> output variables are shifted by one position, the last being set to 0.
....

doc textscan % instead of textread

It has facility to make multiple calls among other enhanced flexibility
capabilities over textread

Unfortunately, my version predates it so can't experiment directly, but
think it'll be more likely to get you where you need to go...

I think the 'collectoutput' option may be of benefit here, btw...

--