How can i exactly click on a point that has drawed on a plot using ginput ?
3 vues (au cours des 30 derniers jours)
My problem is:
I have had some points on a figure use plot command with this command lines:
x = [1 2 3 4 5]
y = [7 8 9 10 11]
for i = 1:5
% Retrieve coordinate of points
[xx,yy] = ginput(length(x))
Now, I want to use ginput() or getPoint() to click on anypoint in the figure.
But, It is difficult to click on a point exxactly.
For example, i want to click on first point that has x = 1 and y = 7. But, when i trying to click on it to retrieve its coordinate, what matlab returns is that i expect (x = 1,y = 7)..
How can i do?????
Please help me!
Thank you so much!
Jan le 11 Jan 2019
Modifié(e) : Jan le 11 Jan 2019
Considering my comment, my answer is:
You can't. You would need a massive zooming to try to do so. Remember, that [1.000000000000000, 7.000000000000000] is not necessarily represented by a pixel on the screen, but selecting a pixel is the maximum achievable resolution.
The solution is to adjust your needs: What about finding the point nearest to the selected pixel?
What about using the ButtonDownFcn of the drawn points instead of ginput?