Filter löschen
Filter löschen

Work with text file

3 Ansichten (letzte 30 Tage)
Mohammad
Mohammad am 22 Feb. 2012
Hi i have a text file (*.txt) and i want to read for example line 6 to line 11 ( only numbers) and save them in to array. the file is like this:
************************************************* * FILMCNV file: 1008A.FLM (PROCESSED: OCT 5, 1991) (GHESHM STATION) ??? , : : .
-L- STN 00000 -5.576558e-02-4.212969e-02-2.849380e-02-1.485791e-02-6.570399e-03-6.516519e-03-1.545398e-02-2.898046e-02-2.987196e-02-2.981792e-02 -2.976321e-02-2.970888e-02-2.965500e-02-3.958659e-02-5.306433e-02-5.301045e-02-5.295634e-02-5.290163e-02-5.284692e-02-5.279221e-02 -5.273817e-02-5.268423e-02-5.262952e-02-5.257510e-02-5.252122e-02-5.246683e-02-5.241212e-02-4.038372e-02-2.878561e-02-2.873091e-02 . .
some texts some numbers ... ***************************************************** could you please help me ? thank you.

Akzeptierte Antwort

nanren888
nanren888 am 23 Feb. 2012
Your text file does not seem to have obvious lines.
Have you looked at fgetl & fgets?
Newer, more powerful functions like textscan exist, but usually there needs to be some predictable structure to use them effectively.
textscan or fscanf or strtok might be useful to parse the lines once you have them.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by