From: Jose on
Hello everyone,

how can I return my structure of data once is updating from a callback function to the main program?

%This s my structure of data called st:

st:

hfigure: {[1] [] [3] [] []}
hz: [0.1000 0.1000 0.1000 0.1000 0.1000]
deltaz: [1 1 1 1 1]
icxx: [0 0 0 0 0]
isxxy: [0 0 0 0 0]

%This is the callback function "stoprecording" to update my structure of data st:

hseek=uicontrol('parent',st.hfigure{e},'String', 'seek',...
'Position', [10,10,60,20]);
set(hseek,'Callback',@(src,event)stoprecording(src,event,st));

function stoprecording(src,~,st)

val=get(src,'parent')

st.icxx(val)=2;

st.hz(val)=2;


return


Thanks in advance.
From: Walter Roberson on
Jose wrote:

> how can I return my structure of data once is updating from a callback
> function to the main program?

You cannot return anything from a callback, so you must use different
approaches, such as nested variables, setappdata() / getappdata(),
setting the Userdata property of a graphics object, or using global
variables.
From: Jose on
Walter Roberson <roberson(a)hushmail.com> wrote in message <bVf6o.53352$dx7.45937(a)newsfe21.iad>...
> Jose wrote:
>
> > how can I return my structure of data once is updating from a callback
> > function to the main program?
>
> You cannot return anything from a callback, so you must use different
> approaches, such as nested variables, setappdata() / getappdata(),
> setting the Userdata property of a graphics object, or using global
> variables.

Thank you Walter.