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

4 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

John Hunt
John Hunt il 30 Lug 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

Più risposte (0)

Categorie

Scopri di più su Data Import and Export in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by