Plot a timeseries and count the days on x-axis.

2 Ansichten (letzte 30 Tage)
Silvan Zeyer
Silvan Zeyer am 9 Dez. 2021
Kommentiert: Silvan Zeyer am 13 Dez. 2021
Hello everyone.
I would like to plot a timeseries with the following code:
load('v_wt_s.mat')
v_wt_s=v_wt_s-273.15;
v_wt_s.TimeInfo.Units = 'hours';
v_wt_s.TimeInfo.Format = 'HH';
plot(v_wt_s)
title('Vorlauf WT-S TTR20-004')
xlabel('Hours')
ylabel('Temperature [°C]')
load('v_wt_s.mat')
I would like to display the hours on the x-axis but what i get is the following:
The scale on the x-axis is still showing the seconds and not the hours.
Does anyone know how to solve this?
Thank you very much for your answers.
  4 Kommentare
VBBV
VBBV am 9 Dez. 2021
Bearbeitet: VBBV am 9 Dez. 2021
Can you ulpoad the file saved in Matlab Version 7.3 & above. I am not able to access it online
Silvan Zeyer
Silvan Zeyer am 10 Dez. 2021
Here is my timetable data in a txt. file.
You could save it in Matlab as a timetable and then start with the code as follows:
v_wt_s=v_wt_s-273.15;
v_wt_s.TimeInfo.Units = 'hours';
v_wt_s.TimeInfo.Format = 'HH'; % Set format for display on x-axis.
plot(v_wt_s)
title('Vorlauf WT-S TTR20-004')
xlabel('Hours')
ylabel('Temperature [°C]')
Thanks a lot!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 11 Dez. 2021
Starting in R2021b, timetables are recommended over timeseries. I would therefore do the following.
load('v_wt_s.mat')
% Convert timeseries to timetable
v_wt_s=timeseries2timetable(v_wt_s);
% Convert time to hours
v_wt_s.Time.Format = "h";
v_wt_s.Data=v_wt_s.Data-273.15;
plot(v_wt_s.Time,v_wt_s.Data)
title('Vorlauf WT-S TTR20-004')
xlabel('Hours')
ylabel('Temperature [°C]')
  1 Kommentar
Silvan Zeyer
Silvan Zeyer am 13 Dez. 2021
That works very well with the new Matlab R2021b verison.
Thanks a lot!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Time Series Events finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by