However, when the ginput function is called in the GUI script, the ginput crosshair isnt confined to the axes but the entire GUI figure. I have tried several methods to set the handles to the axes, for example:
[xp yp] = ginput(handles.axes, 1)
but nothing has worked.
Is there a way to confine ginput to the axes on the GUI only?
Thanks,
Clive
There is not to my knowledge. What you can do is find the bounds of your axes and, if the user selects outside these bounds, make them select again.
Or perhaps in your script, instead of calling ginput directly, you can call the ginput function using the axes ButtonDownFcn property. Since:
ButtonDownFcn is a callback that executes whenever you press a mouse button while the pointer is within the axes, but not over another graphics object parented to the axes.
Clive,
Try exploring the impixel function to do this instead of ginput.
Naresh