Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

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

From: Huy

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

From: Vihang Patil

Date: 04 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: Re: 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

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
uiwait Vihang Patil 03 Jan, 2008 06:19:57
radiobutton Vihang Patil 03 Jan, 2008 06:19:57
guide Vihang Patil 03 Jan, 2008 06:19:57
pushbutton Vihang Patil 03 Jan, 2008 06:19:57
varargout Vihang Patil 03 Jan, 2008 06:19:57
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics