| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Stateflow |
| Contents | Index |
| Learn more about Stateflow |
Stateflow machines arrange Stateflow objects in a hierarchy based on containment. That is, one Stateflow object can contain other Stateflow objects.

The highest object in Stateflow hierarchy is the Stateflow machine. It is an object that contains all other Stateflow objects in a Simulink model. The Stateflow machine contains all the Stateflow charts in a Simulink model. In addition, the Stateflow machine for a model can contain its own data and target objects.
Similarly, charts can contain state, box, function, data, event, transition, junction, and note events. You use all these objects to create a Stateflow chart. Continuing with the Stateflow hierarchy, states can contain all these objects as well, including other states. You can represent state hierarchy with superstates and substates. For example, this chart has a superstate that contains two substates.

In the preceding chart, the engaged superstate contains the first and second substates. The engaged superstate is the parent in the hierarchy to the states first and second. When the event clutch_engaged occurs, the system transitions out of the neutral state to the engaged superstate. Transitions within the engaged superstate are intentionally missing from this example for simplicity.
A transition out of a superstate implies transitions out of any of its active substates. Transitions can cross superstate boundaries to specify a substate destination. If a substate becomes active, its parent superstate also becomes active.
You can organize complex charts by defining a containment structure. A hierarchical design usually reduces the number of transitions and produces neat, manageable charts. To manage graphical objects, use the Stateflow Editor. To manage nongraphical objects, use the Model Explorer or the Stateflow Editor.
![]() | Stateflow Chart Objects | Bibliography | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |