reading complex text files into Matlab

  • Follow


I have a complex  file generated by someone else's fortran code and I need to read some of the data into Matlab. The 1st 44 lines are a mix of text and numerical data and can be ignored for the moment. From line 45 to line 444 there are 3 columns of numerical data which I wish to analyse in Matlab.
e.g.
400.0   -1.1837      0.33
 405.0   -1.2054      0.34
 410.0   -1.2272      0.35
 415.0   -1.2486      0.36
 420.0   -1.2698      0.37
....                  ....           ....
....                  ....           ....
....                  ....           ....

2375.0   -2.6074      0.98
2380.0   -2.6082      0.98
2385.0   -2.6090      0.98
2390.0   -2.6099      0.98
2395.0   -2.6108      0.98

Can some one show me how to get this data into a Matlab array?

Your help will be much appreciated
Alasdair
0
Reply Alasdair 12/6/2010 7:40:08 PM

On 10-12-06 01:40 PM, Alasdair wrote:
> I have a complex  file generated by someone else's fortran code and I
> need to read some of the data into Matlab. The 1st 44 lines are a mix of
> text and numerical data and can be ignored for the moment. From line 45
> to line 444 there are 3 columns of numerical data which I wish to
> analyse in Matlab.

textscan() with HeaderLines 44, a format of '%f%f%f', and CollectOutput set true.

The output from this would be a cell array containing a single matrix that was 
the data you want.
0
Reply Walter 12/6/2010 8:25:10 PM


1 Replies
846 Views

(page loaded in 0.892 seconds)

Similiar Articles:











7/22/2012 4:32:20 AM


Reply: