我的 MATLAB GUI 中有两个按钮。我试图在 button1 的回调函数中识别一个按钮,并对按下哪个按钮做一些事情。我尝试使用按钮组并将所有按钮都放在该组中。单击任何这些按钮时,似乎没有代码。为什么?
这是我的代码:
function uibuttongroup1_SelectionChangeFcn(hObject,eventdata)
switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.
case 'notSimul'
disp('notSimul clicked')
case 'simul'
% Code for when radiobutton2 is selected.
case 'stopTest'
% Code for when togglebutton1 is selected.
case 'start'
% Code for when togglebutton2 is selected.
% Continue with more cases as necessary.
otherwise
% Code for when there is no match.
end