How to remove hh:mm:ss format from app.UIAxes plot?
2 views (last 30 days)
Show older comments
Hi everyone,
I have a GUI where I plot some data over time and am using hh:mm:ss as the time format on the x-axis in app designer. When I tried plotting a histogram to app.UIAxes, I received an error since the hhmmss hasn't been removed: Error using histogram; Values plotted against x-axis must be duration values. To create duration values, use the DURATION function.
I tried the following, but with no success:
cla(app.UIAxes); % Doesn't clear the xaxis
cla(app.UIAxes, 'reset'); % NO BUENO - clears too much!
app.UIAxes.XAxis.TickLabelFormat = '%g'; % This is what it was originally before any plotting
% Error: Error using matlab.graphics.axis.decorator.DurationRuler/set.TickLabelFormat Value must be a duration format.'
Does anyone know how to change the format of the xaxis back to normal without resetting the the UIAxes?
1 Comment
Adam Danz
on 4 Dec 2019
I'm not convinced that the TickLabelFormat is the problem (although, it could be).
Have you tried following the suggestion in the error? Are your x-values in histrogram() durations?
Perhaps a bit of reproducible code would be helpful (not the entire App code, just enough to reporduce the problem).
Answers (0)
See Also
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!