How to get x-axis to be in seconds utilizing the timetick or comparable function
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am plotting time on the x-axis using the datetick, however I want the x-axis to be seconds from the start of the day, ie., from 0 to 86400. I tried datetick('x', 'SS') and that was not an option. Anybody aware on how to get the x-axis in this manner?
start = (datenum('08-Feb-2019 07:32:50:503'));
stop = (datenum('08-Feb-2019 09:26:06:049'));
x = [start start stop stop];
y = [0 1 1 0];
figure; plot(x,y);
datetick('x', 'HH:MM:SS')
0 Kommentare
Antworten (1)
dpb
am 20 Mär. 2019
tfmt='dd-MMM-yyyy HH:mm:ss:SSS';
start = datetime('08-Feb-2019 07:32:50:503','InputFormat',tfmt);
stop = datetime('08-Feb-2019 09:26:06:049','InputFormat',tfmt);
x=duration([0 0 stop-start stop-start])
x.Format='s';
plot(x,y)
plot(x,y)
0 Kommentare
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots 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!