Hi everyone, i have a csv file which contains date and time cells to be imported and represented in different format in matlab graphs when i convert date and time in matlab it doesnt show the correct date and time although ive used different methods to do that.
  • This is one example of date and time format in csv itself (44138.4243609954), this is with general format of cell in excel.
  • When i import to matlab it shows this value (44138.4243609954) when i check it in cell
  • this is the value that it should show in graph axis after right conversion (2020-11-03 10:11:05.000), note: the time in 24h system.
  • the value of date and time that it show instead is (0120-11-04 10:11:79).
Thanks in advance.

댓글 수: 3

Rik
Rik 2020년 11월 5일
It isn't clear to me what the edit was you made, so I don't see how my answer doesn't apply.
omar algburi
omar algburi 2020년 11월 5일
I've added the 4th point to clarify it more. There might be some error in time reference, I'm not sure exactly if I have to calibrate in someway but I have no idea. Btw I've checked the link you've posted last comment but it didn't help unfortunately. Thanks anyway.
datetime(44138.4243609954,'ConvertFrom','Excel')
ans = datetime
03-Nov-2020 10:11:04
I don't see why my answer wouldn't work for you, as you can see it works in R2020b. If you have trouble applying this to your data, you will have to post your data and the code you tried. If you're not using R2020b you should clarify that as well.

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

답변 (1개)

Rik
Rik 2020년 11월 5일

0 개 추천

See the datetime documentation for how to convert Excel dates to a datetime object that you can use in other functions. See the datetick function for how to set your tick labels to a specific date format.

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

질문:

2020년 11월 5일

댓글:

Rik
2020년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by