get the y coordinates by clicking on the plot in matlab
-
29-04-2021 - |
Question
I am trying to get the y coordinates on a xy plot by clicking on the plot. This is very similar to the function ginput which will generate a cursor and by clicking on the plot you can get the x and y coordinates where the cursor is placed. However, for my particular purpose, I want to have a line cross the figure instead of cursor as a guide of determining the right y value to use. Is there any function in matlab can do this? If not, what is the way to do it? Any help is greatly appreciated.
Solution
I don't believe there is a pre-packaged function for that, but you can do it using the strategies described in this video tutorial from Doug Hull, with slight modifications.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow