|
"Rami AbouSleiman" <rdabousl@oakland.edu> wrote in message
<fudij3$lo2$1@fred.mathworks.com>...
> I am trying to use a callback functions that returns a value:
> how can i do it
>
>
> GPS.buttonSix = uicontrol(GPS.fig,'style', 'pushbutton', ...
> 'position', [2 100 135 50],...
> 'string', 'Stop Tracking','callback',@StopTracking);
>
> When the buttonSix is pressed StopTracking is called which
> returns a value.
>
> How can i get and use this value?
> Thank you
Look through the MATLAB GUI documentation for "passing data
between callbacks"
for instance in your gui's opening function:
% Choose default command line output for obs_analyzer
handles.output = hObject;
handles.M1 = nan;
handles.M2 = nan;
% Update handles structure
guidata(hObject, handles);
then if during your callback you can have something like
hanles.M1 = [1 2 3 4]
handles.M2 = [5 6 7 8]
If you wanted to access that data later in another callback
you could.
so just create a field in the handles like
"handles.stop_tracking_return_val" and have StopTracking
store it's return value in that field which is accessible by
other callbacks.
|