Reputation: 41
I'm doing a simple plot in Matlab of windspeed vs time. I converted time using the datenum function, and able to do this plot. However, is there a way to convert the datenum outputs back into a date format when plotting?
Upvotes: 4
Views: 3202
Reputation: 10440
I'm not sure when it was added, but now you can use the datetime
format in the plot
command:
taken from MATLAB docs (have a look also here):
t = 0:seconds(30):minutes(3);
y = rand(1,7);
plot(t,y,'DurationTickFormat','mm:ss')
will generate (something like) this:
Upvotes: 0
Reputation: 3640
You can use the datetick function. It will convert the serial date numbers to human readable date.
Upvotes: 1