Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
GUI button's callback

Subject: GUI button's callback

From: Yuri Geshelin

Date: 26 Jun, 2008 13:27:01

Message: 1 of 3

Can someone explain me this please?

Suppose I set up a callback to a GUI button like this:

set(button_handle,'callback',@my_function)

I noticed that in this case my_function must have at least
2 input arguments, of which the first is button_handle.

My question is, what is the 2nd argument? What do we need
it for?

Thanks,

Yuri

Subject: GUI button's callback

From: Steven Lord

Date: 26 Jun, 2008 13:47:19

Message: 2 of 3


"Yuri Geshelin" <geshelin@hotmail.com> wrote in message
news:g405f5$95h$1@fred.mathworks.com...
> Can someone explain me this please?
>
> Suppose I set up a callback to a GUI button like this:
>
> set(button_handle,'callback',@my_function)
>
> I noticed that in this case my_function must have at least
> 2 input arguments, of which the first is button_handle.
>
> My question is, what is the 2nd argument? What do we need
> it for?

http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f7-55506.html#brdjimp-1

--
Steve Lord
slord@mathworks.com

Subject: GUI button's callback

From: WASHINGTON

Date: 30 Jun, 2008 21:55:34

Message: 3 of 3

Let's see, when you progrm GUI from M.file , you can create button, slider, satic text, etc. using:
hImportar = uicontrol('Style','pushbutton',...
            'String','Importar',...
            'Position',[5 120 100 35],...
            'Parent',rightPanel,...
            'Callback',{@Importar_Callback});

Style,String,Position,Callback are property of uicontrol,
and @Importar_Callback ,call the function:

function Importar_Callback(source,eventdata)
   %put here any action of callabck
   %for exmple, clos the gui
   Close
end

Tags for this Thread

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.

Contact us