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

r = rateControl(20);

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

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

%
% Get Rate object statistics after loop operation.

stats = statistics(r)

% Copyright 2019 The MathWorks, Inc.