How to plot timeline in matlab?

8 Ansichten (letzte 30 Tage)
C Zeng
C Zeng am 16 Aug. 2012
Hi, all,
I want to plot a figure with x-axis is timeline, for example, from 9am to 11pm, and every 10 or 15 minutes are one epoch. Does matlab provide some code for a timeline axis? Thanks.

Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 16 Aug. 2012
% Create dates as serial numbers
serdates = fix(now) + 9/24 : 1/(24*4) : fix(now) + 11/24;
% plot
plot(serdates,rand(1,9))
% Set ticks to serial dates (just to make sure they fall on serdates)
set(gca,'xtick',serdates)
% Format into time
datetick('x','keepticks')
  2 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 16 Aug. 2012
Oleg, why fix(now)?
serdates = 9/24 : 1/(24*4) : 11/24;
is fine
Oleg Komarov
Oleg Komarov am 17 Aug. 2012
If you wanna plot for multiple days you have to start somewhere, I chose now().

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by