필터 지우기
필터 지우기

datestring shows incorrect answers

조회 수: 1 (최근 30일)
navan
navan 2016년 6월 1일
편집: navan 2016년 6월 2일
I have taken a specific date from Igor pro and import it into matlab. the corresponding integer value of the time '1/1/2016 00:00:00.058 'when i upload the file from igor pro into matlab was '3534468465.15625'. When i try to use the date string function
t=3534468465.15625;
string=datestr(t);
the output is coming as '22-Dec-7045 03:45:00'. But the required answer was '1/1/2016 00:00:00.058'. Can some one please help why this error is happening ?

채택된 답변

Thorsten
Thorsten 2016년 6월 2일
편집: Thorsten 2016년 6월 2일
Igor Pro uses the seconds since 1904-01-01. So you can convert it using
dv = datevec(3534468465.15625/(3600*24) + datenum(1904, 1, 1, 0, 0, 0))
Which gives ans =
2016.00 1.00 1.00 4.00 47.00 45.16
This gives the correct year, month and day, but the time is still wrong.
Are you 100% sure that the correct time is '1/1/2016 00:00:00.058 ' and not '1/1/2016 04:47:45.16'?
  댓글 수: 1
navan
navan 2016년 6월 2일
편집: navan 2016년 6월 2일
Dear Thorsten, Thanks a lot for that great help. You are exactly right. Mine output was wrong. The Answer you were getting was the right one and the required answer. thanks again for your valuable time and helping me :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by