Path: news.mathworks.com!not-for-mail
From: "Kenneth Eaton" <Kenneth.dot.Eaton@cchmc.dot.org>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Deleting timers from within their StopFcn
Date: Fri, 5 Dec 2008 21:13:03 +0000 (UTC)
Organization: Cincinnati Children's Hospital Research Center
Lines: 23
Message-ID: <ghc5gu$m61$1@fred.mathworks.com>
References: <ghc4fa$6p5$1@fred.mathworks.com>
Reply-To: "Kenneth Eaton" <Kenneth.dot.Eaton@cchmc.dot.org>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228511583 22721 172.30.248.37 (5 Dec 2008 21:13:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 5 Dec 2008 21:13:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1165924
Xref: news.mathworks.com comp.soft-sys.matlab:505292


Never mind... I just found a situation where things go wrong. If you are in a situation where a program is waiting for a timer to complete, you get an error. Here is an example:

>> ht=timer('ExecutionMode','fixedRate','Period',1,'TasksToExecute',10,...
'TimerFcn','disp(''tick'');','StopFcn','delete(ht)');
>> start(ht); wait(ht);
tick
tick
tick
tick
tick
tick
tick
tick
tick
tick
??? No appropriate method or public field isRunning for class handle.

Error in ==> timer.wait at 46
    end

In this case, I would have to delete the timer after the WAIT command.

Ken