MATLAB GUI 回调函数与应用实例详解
1. 按钮组回调函数
在处理按钮组时,不建议为按钮组内的单个按钮编写回调函数,而应使用按钮组的 SelectionChangedFcn 回调来响应最终用户选择按钮的操作。以下是一个管理两个单选按钮和两个切换按钮的按钮组 SelectionChangedFcn 回调示例代码:
function uibuttongroup1_SelectionChangedFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uibuttongroup1
% eventdata structure with the following fields
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.
case 'radiobutton1'
display('Radio butt
超级会员免费看
订阅专栏 解锁全文
1973

被折叠的 条评论
为什么被折叠?



