How to read a certain part of data from a very complicated text file containing many empty lines
Show older comments
Hi, the text file includes several data structures, delimited by empty lines, like the following: -----------------------------------------
Empty line...
Empty line...
X Y Z
0.2 0.3 0.4
0.2 0.3 0.4
0.2 0.3 0.4
Three Empty lines...
A B C D E F G
Empty line...
0.1 0.2 0.3 0.4 0.5 0.6 0.7
Four Empty lines...
F R I S T G R O U P L O A D I N G
Empty line...
YY YY*C
-0.9 0.154
-0.8 0.023
-0.7 0.087
-0.6 0.098
Empty lines... Other complicated data forms...
-------------------------------------------------
I need only the YY YY*C part, to read the data into a matrix. I've tried textscan and fgetl, neither work since textscan only read one type of data structure,the data format I want is not very distinct from others; and fgetl tend to take empty lines as end of file marker, so it stops at empty lines.
Does anyone has any idea? Thanks a lot since this is very difficult for me to figure it out!
Accepted Answer
More Answers (0)
Categories
Find more on Text Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!