MATLAB Answers

How to format datastamp XTick?

10 views (last 30 days)
Hildo
Hildo on 28 Nov 2016
Answered: Hildo on 29 Nov 2016
How to format datastamp XTick in a Matlab plot to just hour:minute?
I tried to use
xtickformat('dd-MMM-yyyy')
But this function, appear, just to be present in the Matlab R2016b version.

  2 Comments

dpb
dpb on 28 Nov 2016
Which release are you using? What did you use for the time variable?
Hildo
Hildo on 28 Nov 2016
I am using the R2016a. The time variable (x-axis) is created as
Tsim = 60*60*24; % [s].
Tstep = 60*5; % [s].
time = 0:Tstep:Tsim;
timeStamp = timeStamp = datetime( datestr(time/(24*60*60),'HH:MM:SS'),'InputFormat','HH:mm:ss');
I am plotting data in function of timeStamp ( plot(timeStamp,Y1) ).

Sign in to comment.

Accepted Answer

Hildo
Hildo on 29 Nov 2016
I solved this, founding this function
datetick('x','HH:MM')
The is present in the R2016a version.

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags

Products