⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f_typebuttons.asv

📁 digital signal processing常用工具箱
💻 ASV
字号:
function [hc_type,userinput] = f_typebuttons (pos,nt,xm,labels,fcolor,bcolor,cback,userinput,tipstrs,ns)

%F_TYPEBUTTONS: Create radio buttons for type options
%
% Usage: [hc_type,userinput] = f_typebuttons (pos,nt,xm,labels,fcolor,bcolor,cback,userinput,tipstrs,ns);
%
% Inputs: 
%         pos       = position vector of axes
%         nt        = number of radio buttons
%         xm        = input or filter type
%         labels    = cell array of nt strings containing button labels
%         fcolor    = foreground color 
%         bcolor    = background color
%         cback     = cell array of nt callback strings
%         userinput = string continaining name of file for user-defined input 
%         tipstrs   = cell array of tool tip strings
%         ns        = number of radio buttons used to compute spacing
% Outputs: 
%          hc_type   = array of handles to buttons
%          userinput = string continaining name of file for user-defined input 

waxis = pos(3);
haxis = pos(4);
wbox = 0.84*waxis;
dw = (waxis - wbox)/3;
hbox = 0.13*haxis;
dh = (haxis - ns*hbox)/(ns+1);
dz = hbox+dh;
pos0 = [pos(1)+dw,pos(2)+haxis-dz,wbox,hbox]; 
x0 = zeros(1,nt);
x0(xm) = 1;

fsize = 7;

for k = 1 : nt
    hc_type(k) = uicontrol(gcf,...
        'Style','radiobutton',...
        'Units','normalized',...
        'FontName','FixedWidthFontName',...
        'FontSize',fsize,...
        'Position',pos0 + [0 -(k-1)*dz 0 0],...
        'String',labels{k},...
        'Value',x0(k),...
        'ForeGroundColor',fcolor,...
        'BackGroundColor',bcolor,...
        'Tooltipstring',tipstrs{k},...
        'Callback',['xm=' int2str(k) '; '...
        'for p = 1 : nt, '...
        '   if p == ' int2str(k) ', '...
        '      set (hc_type(p),''Value'',1), '...
        '   else, '...    
        '      set (hc_type(p),''Value'',0), '...
        '   end, '...   
        'end; '...
        cback{k}]);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -