MATLAB: Convert CurrentPoint to X and Y Value.

currentpointhandles

This is where we are getting stuck. We would appreciate any insight.
We have a basic figure (linear plot using: and we are using ‘CurrentPoint’ in the code to extract a value from the graph.
Here is the input:
function FcnName(src,evnt,a)
cp = get(gcf, 'CurrentPoint')
disp('click down!!!!')
disp(a)
end
Here is the output:
cp = 341 257
but what we need is the "real" x and y value. Is there a way to accomplish this?
Amanda

Best Answer

x=get(gco,'Xdata');
y=get(gco,'Ydata')