フィルターのクリア

I want to read text file with numeric data with line breaks every few thousand lines?

6 ビュー (過去 30 日間)
Hello, I have a large text file in the format: '%s %s %s %d %f %f %f %f %f %f %f %f %s'.
Within the rows there are breaks in the data denoted by '---BREAK IN DATA ---'.
I have determined the location of each break by using: row_idx = find(~cellfun('isempty',strfind(data,'--- BREAK IN DATA ---')));
How can I read all the rows of data between each break in the data? With textscan I can read up to the first break in the data and then it is cutoff.
Thank you!

採用された回答

Walter Roberson
Walter Roberson 2017 年 1 月 24 日
If it is acceptable to read all of the data, then
datacell = textscan(fid, '%s %s %s %d %f %f %f %f %f %f %f %f %s', 'CommentStyle', '--- BREAK IN DATA ---');
  2 件のコメント
Jorge Mario Guerra González
Jorge Mario Guerra González 2017 年 1 月 24 日
I didn't know one can do that ...great
Greydon Gilmore
Greydon Gilmore 2017 年 1 月 24 日
That works perfectly! Thank you.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by