Find the coordinates of a point chosen on a plot
Show older comments
Hello,
So I've been using ginput to select points on a plot
My plot consists of time(x) and velocity(y).
Below is my user-selected points.
[Userx,Usery] = ginput(1);
However, I noticed it doesn't actually select points from the voltage vs. time graph and instead just a point in the figure screen.
How can I get the nearest data point of the actual plot?
I've found one solution is to use this user created script file:
https://www.mathworks.com/matlabcentral/fileexchange/3265-magnetginput
1 Comment
Dinuka Madhumal
on 9 May 2023
Can anyone help me, what is the problem of this error - Undefined function or variable 'pdist2'. . Do i want to make the 'pdis2' function ?
Accepted Answer
More Answers (1)
Fangjun Jiang
on 12 Nov 2019
0 votes
Use data cursor, set "SnapToDataVertex" to be "on" and then get the position. See example in
doc datacursormode
1 Comment
Categories
Find more on Data Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!