Specify datenum starting value

7 次查看(过去 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

采纳的回答

Star Strider
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 个)

类别

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