我for在MATLAB的GUI的打开功能中有一个循环,我正在尝试使用回调按钮来打破循环.我是MATLAB的新手.这是我的代码:
%In the opening function of the GUI
handles.stop_now = 0;
for i=1:inf
if handles.stop_now==1
break;
end
end
% Executes on button press
function pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to end_segmenting_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.stop_now=1;
guidata(hObject, handles);
Run Code Online (Sandbox Code Playgroud)
出于某种原因,尽管使用句柄定义变量,但按下按钮时循环不会中断.有谁知道发生了什么?谢谢.