%% Get Statistics From Rate Object Execution
% Create a Rate object for running at 20 Hz.

r = robotics.Rate(2);

%
% Start a loop and control operation using the Rate object.

for i = 1:30
    % Your code goes here
    waitfor(r);
end

%
% Get Rate object statistics after loop operation.

stats = statistics(r)

% Copyright 2012 The MathWorks, Inc.