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

1 visualización (últimos 30 días)
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...

Respuestas (1)

Image Analyst
Image Analyst el 25 de Abr. de 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.

Categorías

Más información sobre Data Import and Export en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by