【发布时间】:2011-05-30 04:14:48
【问题描述】:
我在 MATLAB 的 GUI 的打开函数中有一个 for 循环,我正在尝试使用回调按钮来中断循环。我是 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);
出于某种原因,尽管使用句柄定义了变量,但按下按钮时循环不会中断。有谁知道发生了什么?谢谢。
【问题讨论】:
标签: user-interface matlab