This model shows how you can schedule a Simulink algorithm using Stateflow.
The Stateflow chart Chart consists of a Simulink algorithm which needs to run at different rates at different times in the simulation. Stateflow is ideally suited to designing the transition logic which determines when these rate transitions happen. The Simulink algorithm on the other hand is used for the actual data processing. Note that we are merely passing in chart inputs and outputs to the Simulink subsystem. For the purposes of this example, the Simulink algorithm merely adds the input to the output each time it is called.
Upon running the simulation, we see the counter counting at varying rates as shown below: