Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: GUI--radioButton
Date: Wed, 22 Aug 2007 16:03:40 +0000 (UTC)
Organization: QinetiQ Ltd
Lines: 46
Message-ID: <fahmos$g41$1@fred.mathworks.com>
References: <faf5ls$56b$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1187798620 16513 172.30.248.37 (22 Aug 2007 16:03:40 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 22 Aug 2007 16:03:40 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 503430
Xref: news.mathworks.com comp.soft-sys.matlab:424982



Helena; 

Forgive me if I'm wrong; but I think you've missed a
fundamental point of radiobuttons. Try this, and see if it
helps your understanding of your use:

Create a button group in a GUI. It's a type of uipanel, but
should only be used for radiobuttons. Drop two radiobuttons
in there. 

Leave it as it is for the mo, but you can change the
start-up values of radiobuttons if you want: right-click >
property editor > value > change from 0.0 to 1.0.

Start the GUI, then select the unselected button. They
change over automatically, with no need for switch-case or
callbacks.

Now check the m-file. No callbacks have been created. 

If you want code to execute upon change of radiobutton, then
use the uibuttongroup's SelectionChangeFcn (right-click on
the panel in guide > view callbacks > SelectionChangeFcn).

If you want code to determine which of the buttons has been
pressed, use:

h = get(handles.uibuttongroup,'SelectedObject')

This returns the handle to the selected object. Then use:

s = get(h,'String')

To retrieve the string label of the individual button.

If a callback is automatically created by the GUI (e.g. if
you only want one radiobutton, so don't use a group), then
you can't just delete it without deleting the button in
GUIDE first. If it's unwanted; then what I do is just cut
and paste it right to the bottom of the m-file; then forget
about it forever :)

I hope that helps, Kind Regards

Tom Clark