How to read a text file with multiple data sets in it with a starting line?

1 view (last 30 days)
I have a data file that is from a CNC machine with load cells. I want to read it in to matlab and be able to analyze it, but it includes multiple datasets in the same file that are divided by a start line. I usually use readtable or textscan to getdata into matlab, but how can I read it in with the different start lines?
The machine outputs a file that follows the example below.
Header Line (data, x force, y force, z force, etc)
Machine Start Line
DATA,DATA,DATA,DATA
DATA,DATA,DATA,DATA
DATA,DATA,DATA,DATA
Machine Start Line
DATA,DATA,DATA,DATA
DATA,DATA,DATA,DATA
DATA,DATA,DATA,DATA
Machine Start Line
DATA,DATA,DATA,DATA
DATA,DATA,DATA,DATA
DATA,DATA,DATA,DATA

Accepted Answer

John Hunt
John Hunt on 30 Jul 2020
While I was looking into this I ran into the "importdata" function which splits up my data into two parts. The first is "text data" and the other are numbers. In the number matrix I have rows that are all NaN because they are the "Machine Start Line" so I am using that to bring in the data and if there is a NaN to separate it into parts.
Thanks

More Answers (0)

Community Treasure Hunt

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

Start Hunting!