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

4 ビュー (過去 30 日間)
John Hunt
John Hunt 2020 年 7 月 29 日
回答済み: John Hunt 2020 年 7 月 30 日
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

採用された回答

John Hunt
John Hunt 2020 年 7 月 30 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by