MATLAB: Can states in Stateflow charts be listed in order of execution in a generated report by Simulink Report Generator

Simulink Report Generator

I am generating a report for a model containing a Stateflow chart. The chart has several states (parallel and others).
In the report, however, they are not listed in execution order. Having them in execution order would make the report more clear.

Best Answer

Simulink Report Generator does not currently support listing Stateflow charts in order of execution.
Report Generator is unable to parse a Stateflow Chart to determine the order in which its states are executed. Order in which states are executed is controlled by find methods in the Stateflow API.
For example, open your model and execute the following commands:
rt = sfroot
m = rt.find('-isa','Simulink.BlockDiagram')
chart = m.find('-isa','Stateflow.Chart')
states = chart(1).find('-isa','Stateflow.State')
the variable 'states' will contain information on all the states. If you then type:
states(1).Name
states(2).Name
<snip>
As seen in the output, the state order is the same as listed in the report. The example chart loop follows the order specified by the find methods.
For more information on the Stateflow API, see:
Overview of the Stateflow API
<http://www.mathworks.com/access/helpdesk/help/toolbox/stateflow/api/f13-9347.html>
Related Question