function [] = test(varargin)
N.fh=figure('units','pixels',...
'position',[500 250 300 400],...
'color',[0.73 0.83 0.96],...
'menubar','none',...
'name','Title',...
'numbertitle','off',...
'resize','off');
N.bg = uibuttongroup('unit','pix',...
'position',[15 25 270 55],...
'title','Back Ground Color',...
'fontsize',9,...
'backgroundcolor',[0.73 0.83 0.96],...
'foregroundcolor',[0.08 0.17 0.55]);
N.blue = uicontrol(N.bg,...
'style','rad',...
'unit','pix',...
'position',[15 15 50 15],...
'string','Blue',...
'value',1,...
'backgroundcolor',[0.73 0.83 0.96]);
N.green = uicontrol(N.bg,...
'style','rad',...
'unit','pix',...
'position',[110 15 50 15],...
'string','Green',...
'value',0,...
'backgroundcolor',[0.73 0.83 0.96]);
N.gray = uicontrol(N.bg,...
'style','rad',...
'unit','pix',...
'position',[200 15 50 15],...
'string','Gray',...
'value',0,...
'backgroundcolor',[0.73 0.83 0.96]);
set([N.blue,N.green,N.gray],'callback',{@bg_call,N})
function [] = bg_call(varargin)
N = varargin{3};
switch findobj(get(N.bg,'SelectedObject'))
case N.blue
set(N.fh,'color',[0.73 0.83 0.96]);
case N.green
set(N.fh,'color',[0.6 1 0.6]);
case N.gray
set(N.fh,'color',[0.8 0.8 0.8]);
end
Best Answer