image thumbnail
from Order book simulation by Dimitri Shvorob
(a naive artificial stock market)

TimerDriven
classdef TimerDriven < handle
             
   properties (SetAccess = protected)      
      Period
      Timer      
   end
   
   methods
       
       function[obj] = TimerDriven(period)
           obj.Period = period;
           obj.Timer  = timer('TimerFcn',[class(obj) '.getInstance.step'], ...
                              'Period',period,'ExecutionMode','fixedRate', ...
                              'TasksToExecute',Settings.MaxDuration/period);  

       end
       
       function start(obj)
           start(obj.Timer) 
       end       
         
       function stop(obj)
           stop(obj.Timer)
       end
       
   end
   
end

Contact us at files@mathworks.com