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:
how to return a value after a pushbutton is pressed to main function

Subject: how to return a value after a pushbutton is pressed to main function

From: Vihang Patil

Date: 3 Jan, 2008 11:17:38

Message: 1 of 4

Hello
I am trying to send a value to the main function after I
press a pushbutton, but I am unable to do so
for example;

Create a small gui with 2 radiobuttons having tag viz,
radiobutton1 and radiobutton2 and a pushbutton with tag
pushbutton1

Now, after I press pushbutton1 I should be able to pass
some values corresponding to the radiobbutton which
is "On" to the main function. How do I do that. I am using
GUIDE for doing this and I am not able to understand,
whether I should use varargout for this purpose and how
can I use it?

ex:
varargout = selection(varargin)

If I select radiobutton1 and press pushbutton1 then
varargout should have string value "Radiobutton1 selected"
and if radiobutton2 is selected then varargout should have
string value "Radiobutton2 is selected".

Please guide
Thanks
Vihang

Subject: how to return a value after a pushbutton is pressed to main function

From: Huy

Date: 3 Jan, 2008 12:37:15

Message: 2 of 4

"Vihang Patil" <vihang_patil@yahoo.com> wrote in message
<flig8i$nlq$1@fred.mathworks.com>...
> Hello
> I am trying to send a value to the main function after I
> press a pushbutton, but I am unable to do so
> for example;
>
> Create a small gui with 2 radiobuttons having tag viz,
> radiobutton1 and radiobutton2 and a pushbutton with tag
> pushbutton1
>
> Now, after I press pushbutton1 I should be able to pass
> some values corresponding to the radiobbutton which
> is "On" to the main function. How do I do that. I am
using
> GUIDE for doing this and I am not able to understand,
> whether I should use varargout for this purpose and how
> can I use it?
>
> ex:
> varargout = selection(varargin)
>
> If I select radiobutton1 and press pushbutton1 then
> varargout should have string value "Radiobutton1
selected"
> and if radiobutton2 is selected then varargout should
have
> string value "Radiobutton2 is selected".
>
> Please guide
> Thanks
> Vihang
>
>
>
>


Have you tried uiwait function?

http://www.mathworks.com/matlabcentral/newsreader/
view_thread/161436


Anh Huy Phan
RIKEN - BSI

Subject: how to return a value after a pushbutton is pressed to main function

From: Vihang Patil

Date: 4 Jan, 2008 07:03:15

Message: 3 of 4


> Have you tried uiwait function?
>
> http://www.mathworks.com/matlabcentral/newsreader/
> view_thread/161436
>
>
> Anh Huy Phan
> RIKEN - BSI

Hello Huy
Yes I tried the uiwait function and it worked for me.
Thanks
Vihang

Subject: how to return a value after a pushbutton is pressed to main function

From: Vihang Patil

Date: 14 Jan, 2008 14:39:02

Message: 4 of 4

Hello
I have created a small demo gui which addresses to the above
said problem. It located here
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=18212&objectType=file

tinyurl version : http://tinyurl.com/38gk2z

Regards
Vihang

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