MATLAB Answers

C Zeng

About draw a timestamp 2-D plot

Asked by C Zeng
on 31 Jul 2012

Hello, I want to plot a 2-D figure, x-axis is timestamp, y-axis is some quantity. I wonder does matlab have some templates for it?

If not how to mark the x-axis as timestamp? I want to draw a discrete time, every 10 minutes a unit maybe. Thanks.




No products are associated with this question.

1 Answer

Answer by Stephanie
on 31 Dec 2012
Edited by Stephanie
on 31 Dec 2012

%y=whatever data you want it to be

%x=whatever timestamp you are collecting

x=datenum(x); %you need to convert your timestamp into numeric form


datetick('x',0) %look at the support page for datetick. It will show you what matlab date numbers correspond to which formats. (ex: 0=dd:mm:yyyy HH:MM:SS)


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!