필터 지우기
필터 지우기

Date String to x-axis on Plot, Date and Time on Plots

조회 수: 2 (최근 30일)
Samantha Brand
Samantha Brand 2015년 6월 2일
댓글: Samantha Brand 2015년 6월 3일
I need to plot time on a graph in matlab. From my excel sheet, I have the data imported in a number value. In other words, the excel sheet shows serial numbers for dates before it is even imported.
Then I took this column of serial numbers, and converted it to dates using datestr(x).
However, you cannot plot strings. How can I fix this situation to plot(x,y) where x is in dd/mm/yyyy HH:MM:ss format?

답변 (1개)

dpb
dpb 2015년 6월 2일
Which release? If late, see
If you're on an earlier release which doesn't support the datetime object, then
doc datetick % and friends
  댓글 수: 2
Peter Perkins
Peter Perkins 2015년 6월 3일
As dpb says, if you're using R2014b or later, use datetimes. To convert from Excel serial day numbers to datetime, use
d = datetime(exelDates,'convertFrom','excel');
Or if you have MATLAB serial datenums, use 'convertFrom','datenum'.
Samantha Brand
Samantha Brand 2015년 6월 3일
Great, thank you.

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

카테고리

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