Change the x axis in a figure with time

12 次查看(过去 30 天)
Hi all,
I have a question:
I have a figure and I want to change the x axis (which are numbers from 1 to 48) to time scale, like this:
00:00 00:30 01:00......................23:30
any ideas?
thanks

回答(2 个)

Peter Perkins
Peter Perkins 2017-4-26
编辑:Peter Perkins 2017-4-26
In MATLAB R2014b or newer, try this:
>> t = duration(0:.5:23.5,0,0,'Format','hh:mm');
>> x = rand(size(t));
>> plot(t,x)

Jan
Jan 2017-4-26
Did you try datetick already?
  1 个评论
Nikolas Spiliopoulos
thanks for the answer I tried this
datetick('x','HHPM')
but I am getting "12AM" everywhere

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by