view sched/iterate_sched.m @ 0:672052bd81f8

Initial partial import.
author samer
date Wed, 19 Dec 2012 22:38:28 +0000
parents
children
line wrap: on
line source
function tm=iterate_sched(nextfn,X,T,varargin)
% iterate_sched - Iterate function under control of timer
%
% iterate_sched :: 
%    (A->action A)   ~'state transformer action',
%    A               ~'initial state',
%    real            ~'time between updates in seconds'
%    options {
%       drawnow   :: {0,1} /0 ~'call drawnow after each iteration';
%       busy_mode :: {'queue','drop'} /'queue'  ~'See TIMER';
%       its       :: natural / inf ~'iteration limit'
% -> timer.

	opts=prefs('its',inf,'drawnow',0,'busy_mode','queue','props',{},varargin{:});
	if opts.drawnow, post=@drawnow; else post=@nop; end

	tm=rlsched(@action,nows,T,opts.its,iterdata(nextfn,X));
	function t1=action(S,t0,t1)
		disp(S)
		post();
	end
end