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

📄 test_button_group1.m

📁 matlab programming for engineers(2nd)书籍源码,这是一本很好的学习MATLAB编程书
💻 M
字号:
function test_button_group1
fig = figure;
pos = get(gcf,'Position');
pos(3) = 300;
pos(4) = 200;
set(gcf,'Position',pos,'NumberTitle','off','MenuBar','none', ...
    'Name','Test Button Group','ToolBar','none');
h = uibuttongroup('visible','off','Position',[0.1 0.1 0.8 0.8],...
    'Title','Button Group');
u0 = uicontrol('Style','Radio','String','Option 1',...
    'Units','normalized', ...
    'pos',[0.1 0.7 0.8 0.1],'parent',h,'HandleVisibility','off');
u1 = uicontrol('Style','Radio','String','Option 2',...
    'Units','normalized', ...
    'pos',[0.1 0.4 0.8 0.1],'parent',h,'HandleVisibility','off');
u2 = uicontrol('Style','Radio','String','Option 3',...
    'Units','normalized', ...
    'pos',[0.1 0.1 0.8 0.1],'parent',h,'HandleVisibility','off');
set(h,'SelectionChangeFcn',@selcbk);
set(h,'SelectedObject',[]);  % No selection
set(h,'Visible','on');
end

function selcbk(source,eventdata)
disp(source);
disp([eventdata.EventName,'  ',... 
     get(eventdata.OldValue,'String'),'  ', ...
     get(eventdata.NewValue,'String')]);
disp(get(get(source,'SelectedObject'),'String'));
end

⌨️ 快捷键说明

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