Specify datenum starting value
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello everyone,
So I'm trying to make a plot with datenum on the X-axis and outdoor temperature on the y-axis.
I have data from 11 AM - 11 AM the folllowing day.
What i would like to do is have my X-axis start at 11 AM, and end at 11 AM.
However when i plot with the datenum I get the current result

What i would like is the following plot, with dates on the x-axis.

My code is the following:
%% Data
time = [
'11:00:00'
'11:15:00'
...
'10:45:00'
'11:00:00'
];
outdoor_T = [
8.55
8.55
...
5.6
5.6
];
%% Plots
DateNumber = datenum(time, 'HH:MM:SS');
figure
plot(DateNumber, outdoor_T)
datetick('x', 'HH:MM:SS', 'keeplimits')
ylabel('Celcius degrees'), xlabel('Hour of the day')
title('Outdoor temperature')
I tried looking at the documentation for datenum, and unfortunately couldn't find an answer.
I hope my question makes sense, otherwise please ask me to elaborate.
Best regards,
Sander
댓글 수: 0
채택된 답변
Star Strider
2021년 3월 28일
It will be necessary to combine the dates with the time values in order to do what you want. In most instances, this is relatively straightforward, however I would need to see your data to determine how best to do it.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!