Handling different radio buttons

I am writing a code that contains a figure with uicontrols such that two radio buttons are there (Temp in oF, and in oC). I'm havin' a trouble with switchin' the 2 buttons such that only one of them can be selected, can i make this without any button group or selection change fcn?
-If not, then how can be a selection change fcn can be written and what do its elements (new value, ... ) represent?
Here is a crop of the code
h.Rs=uibuttongroup('visible','off','Position',[0 0 .2 1]);
set(h.Rs,'SelectionChangeFcn',@Radio);
set(h.Rs,'SelectedObject',[]);
h.R1=uicontrol('style','radiobutton','position',[60 160 75 25],'string','Temp in oF');
h.R2=uicontrol('style','radiobutton','position',[260 160 75 25],'string','Temp in oC');
...
function Radio
switch get(eventdata.NewValue,'Tag')
case 'h.R1'
R1s=get(h.ET1,'string');Res1=str2num(R1s);
T1s=get(h.ET2,'string');Temp1=str2num(T1s)
T2s=get(h.ET3,'string');Temp2=str2num(T2s);
Res2=Res1*((Temp1+6.77)/(Temp2+6.77));
set(h.T5,'string',num2str(Res2));
case 'h.R2'
R1s=get(h.ET1,'string');Res1=str2num(R1s);
T1s=get(h.ET2,'string');Temp1=str2num(T1s);
T2s=get(h.ET3,'string');Temp2=str2num(T2s);
Res2=Res1*((Temp1+21.5)/(Temp2+21.5));
set(h.T5,'string',num2str(Res2));
end
end

Categories

Find more on App Building in Help Center and File Exchange

Asked:

on 22 Apr 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!