From: mark b. on
hi,
i've got such a question:
this line of a code gets me the value that is returnet by
function 'update':

set(handles.figure1,'windowbuttondownfcn','p=update')

but now i want to put whis value (p) into some variable, so
that i can use it later.but i do not know how.
can anyone suggest me anything?

kind regards
From: Ian Clarkson on
"mark b." <john.doe.nospam(a)mathworks.com> wrote in message
<g3dki1$of8$1(a)fred.mathworks.com>...
> hi,
> i've got such a question:
> this line of a code gets me the value that is returnet by
> function 'update':
>
> set(handles.figure1,'windowbuttondownfcn','p=update')
>
> but now i want to put whis value (p) into some variable, so
> that i can use it later.but i do not know how.
> can anyone suggest me anything?
>
> kind regards

get(handles.figure1,'WindowButtonDownFcn') may work,
assuming i've understood your query properly.
From: mark b. on
i tried it, but it returns me:
ans =

p=update;

and i need the values in 'p'
From: Steven Lord on

"mark b." <john.doe.nospam(a)mathworks.com> wrote in message
news:g3dki1$of8$1(a)fred.mathworks.com...
> hi,
> i've got such a question:
> this line of a code gets me the value that is returnet by
> function 'update':
>
> set(handles.figure1,'windowbuttondownfcn','p=update')
>
> but now i want to put whis value (p) into some variable, so
> that i can use it later.but i do not know how.
> can anyone suggest me anything?

When you write a callback like this, the string you SET as your
WindowButtonDownFcn is executed as though you typed it at the command line,
so the variable p is created in the base workspace.

Instead, I'd recommend either modifying the update function so that it
stores the value it would have output in the figure's UserData property or
in the handles structure (using GUIDATA and/or GUIHANDLES) or explicitly
setting the output into UserData in the callback.


set(handles.figure1,'windowbuttondownfcn','set(handles.figure1,
''UserData'', update)')


Then access either the handles structure or the figure's UserData property
to access the output of the update function.

--
Steve Lord
slord(a)mathworks.com


From: mark b. on
set(handles.figure1,'windowbuttondownfcn','set
(handles.figure1, ''UserData'', update)')

it returns me
??? Undefined variable "handles" or class "handles.figure1".