查看单个帖子
旧 2009-09-15, 15:46   #1
校园恶狼
初级会员
 
注册日期: 2009-05-12
帖子: 1
声望力: 0
校园恶狼 正向着好的方向发展
默认 MatlabGUI中的timer为什么无法停止?

原程序如下:
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按钮无法响应。为什么?
校园恶狼 当前离线   回复时引用此帖