필터 지우기
필터 지우기

findout coordinate from plot

조회 수: 1 (최근 30일)
il147
il147 2022년 3월 14일
답변: Simon Chan 2022년 3월 14일
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
KSSV
KSSV 2022년 3월 14일
You can try datapoints and getpts.

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

답변 (1개)

Simon Chan
Simon Chan 2022년 3월 14일
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

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by