How to read the 3rd column in a line and skip if value is greater than E+37
4 views (last 30 days)
Show older comments
Hello all,
I have a text file with below given format.
16.Mrz.14 10:12:34
16.Mrz.14 10:12:37 -01,22522E-09
16.Mrz.14 10:12:40 -00,90903E-09
16.Mrz.14 10:12:42 -00,72633E-09
16.Mrz.14 10:12:45 -00,59084E-09
16.Mrz.14 10:12:48 -00,50685E-09
16.Mrz.14 10:12:50 -00,42215E-09
16.Mrz.14 10:12:53 -00,38118E-09
16.Mrz.14 10:12:55 -00,32913E-09
16.Mrz.14 10:12:58 -00,29374E-09
16.Mrz.14 10:13:00 -00,25394E-09
16.Mrz.14 10:13:03 +9,900000E+37OADC,+1629586.578736secs,+12454976RDNG#
16.Mrz.14 10:13:06 -000,0389E-09
16.Mrz.14 10:13:09 -000,2374E-09
16.Mrz.14 10:13:13 -000,1355E-09
I have a code written to skip incomplete lines using number of columns but the same logic didn't work when i tried skipping the row with E+37. Could someone tell me how to skip all the rows with the format 16.Mrz.14 10:13:03 +9,900000E+37OADC,+1629586.578736secs,+12454976RDNG? Looking forward to your help
2 Comments
Answers (1)
Azzi Abdelmalek
on 5 Apr 2014
fid = fopen('file.txt');
res={};
while ~feof(fid)
res{end+1,1} =fgetl(fid);
end
fclose(fid);
res(~cellfun('isempty',regexp(res,'E\+37','match')))=[]
See Also
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!