How to shift a graph relative to other graph plotted on same axes in app designed by matlab app designer??

9 次查看(过去 30 天)
Suppose i have plotted 2 graphs in on same UIAxes in matlab App.
There are two points highlighted with x=1.56 (let say x1) and other with x=3.53(let say x2).
After plotting I want to give an option which will shift the x2 to x1 i.e. whole red plot will be shifted to left by an amount of (x2-x1).
Is there any way to shift this grpah using any kinf of slider or Knob , at the same instant as the slider or knob value changes??
Or is it possible to give an option to shift this graph using slider so when slider value changes at the same instant the graph is shifted so uder can know how much graph is
shifted to left or right??

采纳的回答

Clayton Gotberg
Clayton Gotberg 2021-4-24
The answers here explain how to make a slider in the GUI which updates the figure whenever the slider position changes, instead of only when the user lets go of the slider.
You can link the slider value to an x offset so that one of the plots is shifted by that amount when the slider is moved. If you need to be able to grab the points in the figure window, try these answers.
Finally, if the only positions you want to allow are the actual plot and the shifted plot, why not include a switch or button instead of a slider? Those should update near-instantly and won't allow users to set anything in between the two possibilities you want.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by