How to get the mouse click position on Matlab figure axes?

matlab, user-interface

Solution

Once you have created the figure try

[x_coord, y_coord]=ginput(1);

So you get to click once on the figure (that's why the argument is one) and you will get the coordinates returned returned by the function ginput().

Problem

I want to click in a Matlab figure and find out the x and y position of the clicked position. In a graph I think there is a way to click a point on the line and get it's x and y coordinates. How do I do the same if there is no graph plotted?

Original source

Related problems