Filter löschen
Filter löschen

findout coordinate from plot

1 Ansicht (letzte 30 Tage)
il147
il147 am 14 Mär. 2022
Beantwortet: Simon Chan am 14 Mär. 2022
my figure's x is longitude and y is latitude
I use gininput and this is not lon,lat value
I want to know that point of coordinate to lon,lat value
and is there any function that i pick to point on my plot and extract coordinate?
[loni,lati]=ginput(1)
  1 Kommentar
KSSV
KSSV am 14 Mär. 2022
You can try datapoints and getpts.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Simon Chan
Simon Chan am 14 Mär. 2022
Check function datacursormode.
I copy the example from the documentation and you can implement it into your code:
clear; clc;
x = 1:10;
y = x.^2;
scatter(x,y)
dcm = datacursormode;
dcm.Enable = 'on';
dcm.UpdateFcn = @displayCoordinates;
function txt = displayCoordinates(~,info)
x = info.Position(1);
y = info.Position(2);
txt = ['(' num2str(x) ', ' num2str(y) ')'];
fprintf('\nX = %.2f, Y=%.2f\n',x,y); % I added this line so that you know what data are retrieved from this callball
end

Kategorien

Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by