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