Importing ascii data with mixed in headers
Show older comments
I have an old program that creates ascii files with data in a format similar to the below:
Header line
Set 1 Parameter 1 1.0 Parameter 2 1.0 Parameter 3 1.1
0.0000 1.0000 2.0000 3.0000
0.1000 1.0001 2.0001 3.0001
0.2000 1.0002 2.0002 3.0002
Set 2 Parameter 1 2.0 Parameter 2 2.0 Parameter 3 2.1
0.0000 1.0005 2.0005 3.0005
0.1000 1.0006 2.0006 3.0006
0.2000 1.0007 2.0007 3.0007
This pattern repeats for several more sets, and is generally much larger than the simplified form I have presented.
I would like to extract the data from each set, as well as the values of the parameters for each set, but am having trouble doing so. I could go line by line with fgetl, but this doesn't seem particularly efficient in this case. All the bulk data readers that I can think of have problems with the mixed data format created by the parameter lines. Is there a way to extract the information I want without having to pass through the file at each individual line?
2 Comments
Walter Roberson
on 6 Jun 2018
Does the output have to be broken up by block, or can it be all together as if the Set lines were not there?
Bob Thompson
on 6 Jun 2018
Accepted Answer
More Answers (0)
Categories
Find more on Sources in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!