Thread Subject: callback with input

Subject: callback with input

From: Rami AbouSleiman

Date: 19 Apr, 2008 19:53:07

Message: 1 of 2

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

Subject: callback with input

From: Abel Brown

Date: 19 Apr, 2008 20:06:02

Message: 2 of 2

"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.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com