Textscan with repeated header lines. Remove the repeated header lines.
5 views (last 30 days)
Show older comments
I want to extract the values of csv file. The csv files contains repeated headers. Example:
\n
Scan Parameters
\n
Scan Type,Standard Scan
ID,700
Stylus,Radius: 12.5 µm
Length,600.0 um
Duration,30 sec
Resolution,0.067 um/sample
Force,1.00 mg
Measurement Range,524 um
Profile,Hills
\n
\n
Scan Data
\n
Horizontal Distance,Raw Data,
um,A,
0.0,0.0,,
0.1,15.8,,
0.1,15.8,,
0.2,6.8,,
0.3,0.5,,
.......................................
599.8,23.9,,
599.9,30.4,,
599.9,30.2,
\n
Scan Parameters <------- this is the first line of the 2nd set of headerlines
There is a repeated set of headlines in the data file. The first of headlines is 18. Then there is a newline and then follows another set of repeated headlines. I would like to remove all this headers and extract only the values.
For only one set of headerlines I do this and I extract all the values. after the headerlines. I haven't managed to do it with multiple headerlines.
textscan(fid(i), '%f %f','delimiter',',','HeaderLines',18,'MultipleDelimsAsOne',1)
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Data Import and Analysis 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!