how to delete rows that have string in file?
1 回表示 (過去 30 日間)
古いコメントを表示
I want to delete the rows after the date. I tried using data(strcmp(data(:,1), 'END'), :) = [];. My data is 9*23 cell file. Can anyone tell me how to do in a loop?
'5/18/2015'
'END'
'ERROR(s) Encountered:'
''
'Check calibration'
'MVOR - Up or Down Sensor MilliVolt Over-Range value encountered!'
'Check gain adjustments or incident light conditions.'
''
'Check DLC DATE'
0 件のコメント
採用された回答
Walter Roberson
2016 年 1 月 12 日
data( find(strcmp(data(:,1), 'END'), 1, 'first'):end, :) = [];
0 件のコメント
その他の回答 (1 件)
Sonisa
2016 年 1 月 12 日
2 件のコメント
Walter Roberson
2016 年 1 月 12 日
It works fine for me on your sample data.
data = {'5/18/2015'
'END'
'ERROR(s) Encountered:'
''
'Check calibration'
'MVOR - Up or Down Sensor MilliVolt Over-Range value encountered!'
'Check gain adjustments or incident light conditions.'
''
'Check DLC DATE'
};
data( find(strcmp(data(:,1), 'END'), 1, 'first'):end, :) = [];
This leaves data as {'5/18/2015'}
参考
カテゴリ
Help Center および File Exchange で Scope Variables and Generate Names についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!