Hi, i have a question:
When i click near of a pointF (pointF is a point that belongs to the function plotted on the graph), is there a way that "ginput" gives me that pointF?
Example: "ginput" gives me (37.8, 251.3), but the point that belongs to the function plotted is (38, 250), i need that "ginput" gives me (38,250) when i click on (37.8, 251.3)
Regards, and sorry for my Tarzan english xD

 채택된 답변

Sean de Wolski
Sean de Wolski 2012년 1월 5일

1 개 추천

minimum absolute differences kick in again:
xx = 1:10; %xdata
yy = exp(xx);
plot(xx,yy);
[xm ym] = ginput(1); %xmouse, ymouse
%Engine
[~, xidx] = min(abs(xx-xm)); %closest index
[~, yidx] = min(abs(yy-ym));
x_closest = xx(xidx) %extract
y_closest = yy(yidx)

댓글 수: 4

Pablo
Pablo 2012년 1월 5일
*.*, you're my hero! xD
Thanks a lot ;)
Yunus
Yunus 2014년 12월 8일
Hello Mr .Sean de Wolski ;
i have a problem about this topic please help me. so my problem is how can i obtain selected points pixels index .for example i have rgb picture and i want to selecet particular place with mause and i want to get picture's pixel values.
Thans for helping.
Chad Greene
Chad Greene 2014년 12월 9일
Yunus: clickz do what you want?
Sean de Wolski
Sean de Wolski 2014년 12월 9일
Or impoint

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

추가 답변 (1개)

Stefano Dalla Gasperina
Stefano Dalla Gasperina 2020년 9월 10일

0 개 추천

% plot x,y
plot(x,y)
% ginput 10 points
plot(y)
[index,~] = ginput(10);
% plot again
figure();
plot(x(round(index)),y(round(index)));

카테고리

도움말 센터File Exchange에서 Data Exploration에 대해 자세히 알아보기

질문:

2012년 1월 5일

답변:

2020년 9월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by