How to read a text file on a specific line having string and numeric data

1 Ansicht (letzte 30 Tage)
Hi,
How can I read and convert data from a text file on specific lines to a matrix.
The file I have has several formats, for example:
................................................................
. . . . .
. POINT . COORDINATE . RATE VALUES . MEDIUM .
. . . . .
................................................................
. . . . FA .
. 1 . 0.00 . 0.27504825E+13 . .
. 2 . 11.32 . 0.31004130E+13 . .
----------------------------------------------------------------
. . . . FA .
+ . 3 . 11.32 . 0.31004130E+13 . .
. 4 . 22.65 . 0.34565566E+13 . .
----------------------------------------------------------------
etc...

Antworten (1)

Image Analyst
Image Analyst am 25 Apr. 2019
You forgot to attach the file with the paper clip icon. Please do so.
You could read in a line at a time with fgetl() and, if the line does not contain an FA or -----, use strsplit() with that dot character as the delimiter to split up the line into 3 numbers.

Kategorien

Mehr zu Data Import and Export finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by