f



read data skipping column

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
0
Frank
6/29/2010 8:16:19 PM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
606 Views

Similar Articles

[PageSpeed] 46

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...

--
0
dpb
6/30/2010 12:57:47 PM
Reply: