importdata silently misreads text file data

I am importing a text logfile using importdata but finding what appears to be incorrect data within the imported cell array:
a = importdata('cam1_000131.txt');
a{6741}
a{6742}
ans =
'6741 2018-05-21 11:03:53.948318'
ans =
'6742 2018-05-21 11:03:53.948318'
The imported cells show duplicate times imported from the log file. Meanwhile the text file at those lines does not contain duplicate data (oddly the line numbers in the text file are correctly imported and not duplicated) :
lines from 'cam1_000131.txt' (text file is attached to post):
6740 2018-05-21 11:03:53.885769
6741 2018-05-21 11:03:53.916993
6742 2018-05-21 11:03:53.948318
6743 2018-05-21 11:03:53.995122
Any thoughts? What is a more reliable way to easily read in text file log data by separate lines for parsing? Thanks in advance.

 채택된 답변

Geoff Hayes
Geoff Hayes 2019년 2월 17일

0 개 추천

Rahul - in the file you have attached, I do see the duplicated data at these lines
6740 2018-05-21 11:03:53.885769
6741 2018-05-21 11:03:53.948318
6742 2018-05-21 11:03:53.948318
6743 2018-05-21 11:03:53.995122
Perhaps you are not reading from the file that you think that you are reading from?

추가 답변 (1개)

Rahul
Rahul 2019년 2월 17일

0 개 추천

Yes another answerer alerted me to my error. Thank you. There are multiple logfiles generated in parallel and I was looking at a different version. None of them are supposed to have duplicate times but that is clearly coming from an error in logic somewhere upstream in the code that I'll have to work out. Thanks again.

카테고리

도움말 센터File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2019년 2월 17일

답변:

2019년 2월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by