MATLAB: How to plot timeline in matlab

timeline

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.

Best Answer

% 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')