I get date info when plot a Datetime in x-axis.
12 views (last 30 days)
Hi, I am trying to plot a voltage data vs time data (HH:MN:SS) from a Datetime, but when I build the graph the x-axis always take the Year data (Dec 31, 1899).
I have tried modified the Datetime and the axis parameters, but always get this info.
How can I only display Hour:Minutes:Seconds? The year info is not important for me.
dpb on 2 Apr 2021
Edited: dpb on 2 Apr 2021
Another case of TMW being too aggressive in hiding things from the end user inside graphics objects -- the year/date 'SecondaryLabel' property is hidden and is shown by default for all datetime axes.
hAx=gca; % retrieve the current axes handle
to make the year marker not be visible.
The alternative is to subtract the first time value of your datetime vector from all elements and convert to a duration and plot against it instead of the absolute time values.
dt=Time2-Time2(1); % convert to elapsed time; is a ML duration, not a datetime