how to delete rows that have string in file?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sonisa
am 12 Jan. 2016
Kommentiert: Sonisa
am 12 Jan. 2016
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 12 Jan. 2016
data( find(strcmp(data(:,1), 'END'), 1, 'first'):end, :) = [];
0 Kommentare
Weitere Antworten (1)
Sonisa
am 12 Jan. 2016
2 Kommentare
Walter Roberson
am 12 Jan. 2016
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'}
Siehe auch
Kategorien
Mehr zu Low-Level File I/O finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!