How to move a line on click in app designer

조회 수: 10 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2019년 9월 16일
답변: MathWorks Support Team 2019년 9월 16일
How to move a line to a position on click in app designer?
Consider a horizontal line. If you wanted to move this line and perform certain changes to your graph post this update. How would you do this?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2020년 5월 8일
Since the axis does not directly have a callback, use the 'WindowButtonDownFcn' on the UIFigure instead. You can use the 'CurrentPoint' property to fetch the location of the cursor and move the line to that particular position by updating the 'XData' or 'YData' based on the requirement.
Attached is a sample application that uses a sine wave and a green horizontal line. The green horizontal line divides the sine wave into two parts, the red part(above the green line) and the blue part(below the green line). Once you move the green line, the red and blue parts are updated accordingly.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by