Extract data from ASCII text file from specific lines and columns

1 Ansicht (letzte 30 Tage)
Wan Nawi
Wan Nawi am 18 Apr. 2012
Hi Guys,
I have a compilation of reports in an ASCII file (see the file here: http://pastebin.com/wmmB92ZC ) I want to export them to MATLAB and I know the specific location of the data in column and line.
For example, the data for parameter N1 is located at line 37&38 at column 4. The next data for N1 comes after every 53 lines, which are 90&91, 143&,144 and so on.
I did try with text scan, but there is no option to specifically tell the exact location of the data in columns and lines.
Any help would be appreciated.
Thanks.
Regards, Wan

Antworten (1)

Walter Roberson
Walter Roberson am 18 Apr. 2012
There is an undocumented textscan() option to specify column location. Unfortunately it only works with purely numeric data.
Anyhow, use the HeaderLines parameter to indicate how many lines to skip. Use a '%*s%*s%*s%d' format to skip the fist 3 columns and read the 4th as a number.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by