MATLAB Answers

Year conversion on figure wrong

Benjamin Cowen 님이 질문을 제출함. 29 Jun 2019
최근 활동 Walter Roberson 님이 댓글을 추가함. 29 Jun 2019
If I read in a date, say 7/15/2017, but I read it in as 42931.00, when in MATLAB when I do this:
datetick('x', 'yyyy');
I get the year as 0117 instead of 2017?

  댓글 수: 0

로그인 to comment.


답변 수: 1

per isakson 님의 답변 29 Jun 2019
per isakson 님이 편집함. 29 Jun 2019

That's most likely because 42931.00 is an Excel date number, not a Matlab date number.
MATLAB date numbers start with 1 = January 1, 0000 A.D., hence there is a difference of 693960 relative to the 1900 date system

  댓글 수: 4

표시 이전 댓글 수: 1
datetime 'convertfrom' 'excel'
when i do this:
t = datetime(date,'ConvertFrom','excel');
why does the x axis only show the begin and end date for this:
datetick('x', 'yyyy');
date is a function that returns a single character vector, that datetime then converts into a single datetime object. If you plot with that as your only data point then MATLAB invents start and end times.

로그인 to comment.

Translated by