matlab按钮组代码,matlab buttongroup switch case按钮组回调函数
S.fh = figure('units','pixels',...'position',[200 250 250 200],...'menubar','none',...'name','GUI_41',...'numbertitle','off',...'resize','off',...'closerequestfcn',{@fh_crfcn});S.bg = uibuttongroup('u
S.fh = figure('units','pixels',...
'position',[200 250 250 200],...
'menubar','none',...
'name','GUI_41',...
'numbertitle','off',...
'resize','off',...
'closerequestfcn',{@fh_crfcn});
S.bg = uibuttongroup('units','pix',...
'pos',[20 70 210 90]);
S.SEL = 1; % The selectedobject property of S.bg S.rd(1) = uicontrol(S.bg,...
'style','rad',...
'unit','pix',...
'position',[20 50 70 30],...
'string','Linear');
S.rd(2) = uicontrol(S.bg,...
'style','rad',...
'unit','pix',...
'position',[20 10 70 30],...
'string','Quadratic');
S.rd(3) = uicontrol(S.bg,...
'style','rad',...
'unit','pix',...
'position',[120 50 70 30],...
'string','Cubic');
S.rd(4) = uicontrol(S.bg,...
'style','rad',...
'unit','pix',...
'position',[120 10 70 30],...
'string','Quartic');
function [] = pb_call(varargin)
sel = findobj(get(S.bg,'selectedobject')); % See BUG note in GUI_8
S.SEL = find(S.rd==sel); % Store current radiobutton.
switch sel case S.rd(1) % Linear S.RP(1:3) = 0; S.COL = 'r'; case S.rd(2) % Quadratic S.RP(1:2) = 0; S.COL = 'k'; case S.rd(3) % Cubic S.RP(1) = 0; S.COL = 'b'; case S.rd(4) % Quartic S.COL = 'm'; otherwise % Very unlikely I think. end
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)