MATLAB: ButtonDownFcn / need some explanation

buttondownfcnclickdatacursormodefigurepush buttonsubplot

Hey Guys,
I ve read a lot of stuff for the last 2 hours but I still dont know how to use the Function. The Problem: My GUI reads Data and plots it in a new figure as subplot.(Figurename = Plot) Now I want to create a Push button, which uses somehow the ButtonDownFcn to give me the coordinates of where I clicked…… Qestions: How does the ButtonDownFcn work ? Is there a another alternative ? Can i Activate the datacursormode for my Plot-figure ?
Thanks

Best Answer

Why not have a push button where in the callback function, you call
uiwait(helpdlg('Click in the plot'));
[x, y] = ginput(1);
Your user clicks in the plot and ginput() returns the x and y of where they clicked.