I have an old program that creates ascii files with data in a format similar to the below:
Header lineSet 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.0002Set 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?
Best Answer