The Simulink® Real-Time™ software supports the animation of Stateflow® charts in your model to provide visual confirmation that your chart behaves as expected.
You must be familiar with the use of Stateflow animation. For more information on Stateflow animation, see Animate Stateflow Charts (Stateflow).
You must have already set Stateflow states as test points
open_system(docpath(fullfile(docroot, 'toolbox', 'xpc', 'examples', 'ex_slrt_sf_car')))).
If you have not, see Configure Stateflow States as Test Points.
Open the external mode control panel. In the Simulink Editor, in the Real-Time tab, click Prepare > Control Panel.
Select Signal & Triggering.
In the Trigger section of the External Signal & Triggering window:
To direct the trigger to re-arm after the trigger event completes, set
To select the number of base rate steps for which external mode uploads data
after a trigger event, in the Duration box, enter
To direct data upload to begin immediately after the trigger event, select the Arm when connecting to target check box.
Click Apply. For more information about signal and triggering options, see Configure Host Monitoring of Target Application Signal Data (Simulink Coder).
Open Configuration Parameters. On the Real-Time tab, click Hardware Settings.
Select Simulink Real-Time Options > Miscellaneous options > Enable Stateflow animation.
Verify that Stateflow animation is enabled for Simulink Real-Time. In the MATLAB Command Window, type:
ans = 'on'
Connect to the target computer. On the Real-Time tab, toggle the Disconnected indicator to Connected.
Build and download the model to the target computer. On the Real-Time tab, click Run on Target.
The simulation begins to run. You can observe the animation by opening the Stateflow Editor for your model.
To stop the simulation, on the Real-Time tab, click Stop.
Enabling the animation of Stateflow charts also displays additional Stateflow information. The Stateflow software requires this information to animate charts. You can disregard this information.