Specify datenum starting value

5 vues (au cours des 30 derniers jours)
Sander Ustrup
Sander Ustrup le 28 Mar 2021
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

Réponse acceptée

Star Strider
Star Strider le 28 Mar 2021
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.

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by