登录论坛

查看完整版本 : [MATLAB GUI] MatlabGUI中的timer为什么无法停止?


校园恶狼
2009-09-15, 15:46
原程序如下:
function start_Callback(hObject, eventdata, handles)
% hObject handle to start (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(handles);
timerID=timer('timerFcn',{@timerCallback},'ExecutionMode','fixedDelay','Period',10.0);
stoprun=get(hObject,'Value');
if stoprun
start(timerID);
else
alltimers = timerfind;
if length(alltimers)>0
stop(timerID);
delete(alltimers);
end
end
其中timerCallback为数据采集的程序,start按钮为toggle按钮。在程序运行时,点击start按钮无法响应。为什么?