How to plot timeline in matlab?

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.

 채택된 답변

Oleg Komarov
Oleg Komarov 2012년 8월 16일

0 개 추천

% 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

Oleg, why fix(now)?
serdates = 9/24 : 1/(24*4) : 11/24;
is fine
Oleg Komarov
Oleg Komarov 2012년 8월 17일
If you wanna plot for multiple days you have to start somewhere, I chose now().

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

질문:

2012년 8월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by