the unit will change from second to microsecond during zoom in

7 views (last 30 days)
In the Matlab plot, I want the unit to adapt when I zoom in or zoom out. For example, for a 1-second record, when I zoom in to microsecond scale, I would like the number at x-axis to be something like 2.5 µs rather than 25*1e-7. Of course I want to xlabel to be changed from 'second ' to 'microsecond'as wekk.
Thanks!

Accepted Answer

Cam Salzberger
Cam Salzberger on 11 Apr 2018
Hello,
By default, MATLAB sticks to a consistent "unit" that matches with the data provided, since there is no other real way for MATLAB to know what units you are trying to use. Probably the easiest way to manage what you are looking for is to make a custom callback for a zoom action, and have that manage the tick locations, labels, and x-axis labeling. The ActionPostCallback is probably the one to use, since you can simply get the current limits of the axis to calculate desired tick labels.
-Cam

More Answers (0)

Categories

Find more on Visual Exploration in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!