timer/waitfor

hello everybody, I'm french so excuse me for my english. I'm doing a GUI and I want to do a loop while until a checkbox is checked. I choose to use timer/waitfor because I have others things to do if the chekbox is not checked, but it doesn't work :
while tline==-1
tline = fgetl(fid)
t = timer('Period', 10.0);
w=waitfor(t);
if w==0
test=0 ;
return;%if the chackbox is checked I exit my loop
end
end
but I have this mistake :
??? Error using ==> timer.waitfor Too many output arguments.
Error in ==> test>TimeReal at 604 w=waitfor(t);
Error in ==> test>TRE_Callback at 635 TimeReal(handles);
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> test at 46 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)test('TRE_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
how I have to do??? thank you for your help!!!

Answers (1)

Fangjun Jiang
Fangjun Jiang on 18 Aug 2011

0 votes

First of all, waitfor() doesn't have return argument. That is what the error message tries to tell you.
Second, I don't think you can achieve what you want. type doc waitfor to find out what waitfor() function is about.

Categories

Find more on Historical Contests in Help Center and File Exchange

Asked:

on 18 Aug 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!