From: Riikka on
"Robert " <notrust(a)lummert.net> wrote in message <i41ols$2mo$1(a)fred.mathworks.com>...
> "Riikka " <nurminen_riikka(a)hotmail.com> wrote in message <i401ss$ag8$1(a)fred.mathworks.com>...
> > http://www.mathworks.com/support/solutions/en/data/1-1V97EZ/?solution=1-1V97EZ
> >
> > The solution behind the link above is what I want to do, but I don't manage to do this in my GUI. I have one axis and I would like the GUI to show the current position of the mouse in a text box.
> >
> > In addition to this, i would like there to be an option to save coordinates by a mouse click when wanted. How is this done?
> >
> > Thanks for your help!
>
> 1. give code
> 2. use ButtonDownFcn of graphics object
>
> Cheers,
>
> Robert

Thanks Robert. Unfortunately I can't give the code, because it doesn't exist yet. I managed to do part 1 with a figure outside my GUI just by using the code in the link above.

set (gcf, 'WindowButtonMotionFcn', @mouseMove);

function mouseMove (object, eventdata)
C = get (gca, 'CurrentPoint');
title(gca, ['(X,Y) = (', num2str(C(1,1)), ', ',num2str(C(1,2)), ')']);

In which part of the GUI should I set the WindowButtonMotionFcn and ButtonDownFunction property to the figure in axis1? I probably just define the function mouseMove at the end of the GUI M-file, but I don't know where to put the first line (set...).
 | 
Pages: 1
Prev: cumsum/cumtrapz
Next: cumsum/cumtrapz