Mercurial > hg > ltpda
view m-toolbox/classes/@LTPDARepositoryManager/startTimer.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line source
% STARTTIMER returns a started timer. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % description: STARTTIMER returns a started timer. % % call: t = startTimer(name, fcn, period) % % inputs: name - name of the timer % fcn - call back function of the timer % period - period of the timer % % outputs: t - new timer object. % % version: $Id: startTimer.m,v 1.3 2011/02/03 13:44:02 ingo Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function t = startTimer(name, fcn, period) t = timerfind('name', name); if isempty(t) || (isa(t, 'timer') && ~isvalid(t)) t = timer(... 'TimerFcn', fcn, ... 'StartDelay', period, ... 'Period', period, ... 'ExecutionMode', 'fixedRate', ... 'Name', name); end % start the timer if ~strcmp(get(t,'Running'), 'on') start(t); end end