How to read the 3rd column in a line and skip if value is greater than E+37
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Azzi Abdelmalek
2014년 4월 5일
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')))=[]
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!