How can I read the point coordinates from a graphic?

1 回表示 (過去 30 日間)
Flávio
Flávio 2013 年 4 月 24 日
I want to read the x and y coordinates of a certain point of the graphic when I click in that point. Is there any way to do it?
Sorry for my bad English!
Thanks

採用された回答

Image Analyst
Image Analyst 2013 年 4 月 25 日
Try ginput:
plot(1:10);
grid on;
uiwait(msgbox('Click a point'));
[x,y] = ginput(1)
  2 件のコメント
Flávio
Flávio 2013 年 4 月 25 日
It works. But now I want to use it in a GUI axes. I have a graphic associated with handles.axes1, and I want to do obtain the coordinates. For example, everytime I select a point the coordinates appear in editboxes. The thing is, axes don't have callbacks. So how can I trigger the action? In other words, where do I put the code? Thanks again!
Image Analyst
Image Analyst 2013 年 4 月 25 日
Have a button with a captions that says something like "Select a point..." and then call that code (put it in the button callback) when the user clicks the button, which indicates that they are ready to specify a point on the axes.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Exploration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by