How to storage the coordinates of a pixel in Gui?

조회 수: 1 (최근 30일)
anahita
anahita 2013년 7월 8일
In the Gui that I've created, the user should be able to click somewhere on the displaying image in an axes, and storage the coordinates of that pixel too use them later, but I don't know how should I 1. find the coordinates and 2. storage them for using them in another function later...

채택된 답변

Evan
Evan 2013년 7월 8일
편집: Evan 2013년 7월 8일
help ginput
That function will get the coordinates of the pixel the user clicks. You could have the user press a pushbutton to enable the pixel selection, then put your ginput call in the pushbutton callback.
Then, you can store these values by saving them to the handles structure:
[x,y] = ginput(N) %where N is the number of points desired
handles.X = x;
handles.Y = y;
guidata(handles.my_pushbutton,handles)
  댓글 수: 2
anahita
anahita 2013년 7월 8일
Thank you so much for the answer
Evan
Evan 2013년 7월 8일
편집: Evan 2013년 7월 8일
No problem! :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by