Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: GUI - grouping radio buttons
Date: Sat, 29 Nov 2008 16:56:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <ggrs72$308$1@fred.mathworks.com>
References: <ggmv61$olj$1@fred.mathworks.com> <ggn1h2$jab$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 1227977762 3080 172.30.248.37 (29 Nov 2008 16:56:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 29 Nov 2008 16:56:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1338633
Xref: news.mathworks.com comp.soft-sys.matlab:503800


"Mark " <rs_camaro92@remove.thishotmail.com> wrote in message <ggn1h2$jab$1@fred.mathworks.com>...
> I also want to note that I'm using GUIDE to set the position and names of the group and radio buttons along with everything else in my GUI.  I then go into the code and tie it into what I need the GUI to do.
> 
> I read through many other threads on similar issues, but didn't find any that used GUIDE in making the set-up I'm trying for.  I found some code and tweaked it a bit, but it still doesn't work.  Here's what I found and edited to suit my needs:
> 
> heartrate=uibuttongroup('Position',[.85 .85 .13 .03], 'SelectionChangeFcn',@grv,'units','normalized');
>     uicontrol('Style','Radiobutton','Parent',heartrate,'String','Rest (60 bpm)', 'Position',[0 1 1 1],'units','normalized');
>     uicontrol('Style','Radiobutton','String','Exercise (120 bpm)', 'Position',[0 0 1 1],'Parent',heartrate,'units','normalized');
> 
> I have no clue what the @grv code means, but when I run this, that gives me errors.


You can create a radiobutton panel in guide which will only let you select one radiobutton at a time. 

To set the defaults set the value to 1 for selected and 0 for unselected for each radiobutton using set(radiobutton1,'Value',1). Put this in the part of the m file towards the top which is carried out before the GUI is displayed.