%% Dynamic Priority Scheduling of Functions
% This example shows a common modeling pattern to dynamically schedule the
% execution of functions using a Stateflow(R) chart.
%
% Copyright 2017 The MathWorks, Inc.

%% Overview
% Simulink messages provide intrinsic support for creating and managing
% priority queues, which may be used to model a situation in which the
% execution order of the functions may change between execution intervals.
%
% Additionally, the Sequence Viewer allows you to visualize execution
% sequences. To view the dynamically changing execution sequence:
% 1. Double-click on the 'Sequence Viewer' block
% 2. Click the 'Run' button once

mdl = 'slexDynamicSchedulingExample';
open_system(mdl);
curDir = pwd;
cd(tempdir);

%%

close_system(mdl, 0);
cd(curDir);
