在matlab中的另一个回调中使用按钮的回调

在matlab中的另一个回调中使用按钮的回调,matlab,matlab-guide,Matlab,Matlab Guide,我的MatlabGUI中有两个按钮。我试图识别button1的回调函数中的一个按钮,并对按下的按钮做一些操作。我尝试使用按钮组,并将我所有的按钮都放在该组中。单击这些按钮时,似乎没有代码。为什么? 这是我的密码: function uibuttongroup1_SelectionChangeFcn(hObject,eventdata) switch get(eventdata.NewValue,'Tag') % Get Tag of selected object. ca

我的MatlabGUI中有两个按钮。我试图识别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

如果我正确理解您的问题,即您在按钮组中放置了一个按钮,那么答案是该按钮不起作用,因为按钮组应该仅由切换按钮和单选按钮组成。当我试着把一个按钮放在一个按钮组中时,什么也不会发生,正如你所描述的

您能给我们展示一下将标签分配给项目以及将回调添加到按钮的代码吗?您是否尝试过在switch语句中放置断点并查看NewValue标记是什么?