Getting positions without clicking on plot with ginput command

Hello everyone,
I am trying to get positions at the following map with ginput command. But the problem is I want to see the position of the point before clicking it.
Is it possible to that? After I clicked N points I can see positions, but I can not click them anymore. I should see the position first and after that I need to click it.
Thanks in advance!
Here is the code:
clc
clear
close all
geoaxes('Units','normalized');
N=5;
set (gcf, 'WindowButtonMotionFcn', @mouseMove);
for i=1:N
[lat,lon]=ginput(1)
hold on
geolimits('manual')
geoscatter(lat,lon,'filled','b')
end
set (gcf, 'WindowButtonMotionFcn', @mouseMove);
function mouseMove (object, eventdata)
C = get (gcf, 'CurrentPoint');
title(gca, ['(X,Y) = (', num2str(C(1,1)), ', ',num2str(C(1,2)), ')']);
end

3 件のコメント

Walter Roberson
Walter Roberson 2020 年 1 月 22 日
Be careful: WindowButtonMotionFcn is attached to the figure, but when you are asking for coordinates similar to what you would get with ginput(), you almost always want axes coordinates instead of figure coordinates.
Walter Roberson
Walter Roberson 2022 年 1 月 11 日
Sorry, I do not have much experience with App Designer.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Exploration についてさらに検索

質問済み:

2020 年 1 月 22 日

コメント済み:

2022 年 1 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by