MATLAB: Radio Buttons in panel

dependancyparentradio button

I created two radiobuttons on panel in GUI through script.I can select both at the same time (ie) selection is not removed when another radio bttn is selected.
Even I checked the parent of both radio button. It is same.
f1=get(findall(0,'Tag','English0'),'Parent')
f2=get(findall(0,'Tag','Metric1'),'Parent')
f1 and f2 both are same Then why a normal radio buttons functionality in single panel is not achieved?
Please suggest ideas.

Best Answer

Panels are basically just cosmetic. Use a uibuttongroup to manage the exclusivity behavior you want. Compare:
figure
pnl = uipanel('position',[0.1 0.1 0.5 0.5]);
b1 = uicontrol('parent',pnl,'units','normalized','position',[0.1 0.1 0.8 0.4],...
'style','radiobutton','string','I am a choice');
b2 = uicontrol('parent',pnl,'units','normalized','position',[0.1 0.5 0.8 0.4],...
'style','radiobutton','string','I am a choice');
versus
figure
pnl = uibuttongroup('position',[0.1 0.1 0.5 0.5]);
b1 = uicontrol('parent',pnl,'units','normalized','position',[0.1 0.1 0.8 0.4],...
'style','radiobutton','string','I am a choice');
b2 = uicontrol('parent',pnl,'units','normalized','position',[0.1 0.5 0.8 0.4],...
'style','radiobutton','string','I am a choice');