Specify datenum starting value
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sander Ustrup
el 28 de Mzo. de 2021
Respondida: Star Strider
el 28 de Mzo. de 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
0 comentarios
Respuesta aceptada
Star Strider
el 28 de Mzo. de 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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!