How can I add time labels to the x-axis of my plot?

1 次查看(过去 30 天)
sample data .if i have data like this how to plot with exact date and time
with seconds give me a program
31/08/97 03:03:32
31/08/97 03:07:39
31/08/97 03:10:46
31/08/97 03:15:46
31/08/97 03:26:59
31/08/97 03:28:00
31/08/97 03:42:56
31/08/97 03:54:23
31/08/97 03:56:57
31/08/97 04:07:00
31/08/97 04:47:51
31/08/97 22:07:59
  1 个评论
dpb
dpb 2014-4-16
编辑:dpb 2014-4-16
See
doc datenum
doc datetick
and examples thereat
ADDENDUM:
OK at machine w/ a minute...try
>> dn=datenum(datevec(t,'dd/mm/yy HH:MM:SS')); >> plot(dn,rand(size(dn))) >> datetick('x','keeplimits','keepticks')
NB: I cleaned up the above data strings that had tab here and there down to a single space; use format as needed for the actual form.

请先登录,再进行评论。

回答(1 个)

Ralf
Ralf 2014-4-16
I hope it is clear now:
DateTime{1,1} = '31/08/97 03:03:32'; %
DateTime{1,2} = '31/08/97 03:07:39'; %
Yvalue = [3 4]; % Example values
ts1 = timeseries(Yvalue,DateTime); % Create a timeseries object whit oure yvalue %and the time scale
ts1.Name = 'Warming up off ... '; % Give it a name
plot(ts1); % Create a plot of it.
grid ('on');

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by