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

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

John Hunt
John Hunt el 30 de Jul. de 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

Más respuestas (0)

Categorías

Más información sobre Data Import and Export en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by