フィルターのクリア

load a txt file with variable header

4 ビュー (過去 30 日間)
CSCh
CSCh 2020 年 12 月 14 日
コメント済み: CSCh 2020 年 12 月 20 日
Hi Everyone,
i want to "load" multiple txt-files but they have variable header. However all files looks like this:
*bla bla
*bla
*bla
....(between 50-50 rows)
then the main part begins, containing tabstop separated, 29 col and variable rows ~200 with my sensor data, however containing also not only numerics also "Nan" too.
I need some help to just start integrating the textfile skipping all rows beginning with "*" . Or better all rows +1 because the first row of my sensor data starts with "nans".
Thanks
Chris
  2 件のコメント
dpb
dpb 2020 年 12 月 14 日
There's a 'CommentStyle' in textscan or readtable
You might be surprised at how well just using detectImportOptions work, too.
CSCh
CSCh 2020 年 12 月 15 日
Can you please give me an example how to use detectImportOptions for my issue?

サインインしてコメントする。

回答 (1 件)

Gouri Desai
Gouri Desai 2020 年 12 月 16 日
I understand that you are trying to read multiple text files with varying headers. Also, you want to read specific rows/columns of data beginning with a ‘*’.
detectImportOptions is a great way to choose the type of data, row and column, or the start and end conditions on data points in a file. Check out the Name, Value pairs in it's documentation page.
You can use it in combination with readtable to obtain a table having the data points satisying the properties set with detectImportOptions.
Do check this resource for more information:
  1 件のコメント
CSCh
CSCh 2020 年 12 月 20 日
Thank you Sir, got it!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by