Stateflow    

States

This section describes Stateflow's primary object, the state. States represent modes of a reactive system. See the following topics for information about states and their properties:

What Is a State?

A state describes a mode of a reactive Stateflow chart. States in a Stateflow chart represent these modes. The following table shows the button icon for a drawing a state in the Stateflow diagram editor and a short description.

Name
Button Icon
Description
State

Use a state to depict a mode of the system.

State Hierarchy

States can exist as superstates, substates, and just states. A state is a superstate if it contains other states, called substates. A state is a substate if it exists in another state. A state that is neither a superstate nor a substate of another state is just a state.

Every state is part of a hierarchy. In a Stateflow diagram consisting of a single state, that state's parent is the Stateflow diagram itself. A state also has history that applies to its level of hierarchy in the Stateflow diagram. States can have actions that are executed in a sequence based upon the types of its actions. The action types are entry, during, exit, or on event_name.

Active and Inactive States

When a state is active, the chart takes on that mode. When a state is inactive, the chart is not in that mode. The activity or inactivity of a chart's states dynamically changes based on events and conditions. The occurrence of events drives the execution of the Stateflow diagram by making states become active or inactive. At any point in the execution of a Stateflow diagram, there is a combination of active and inactive states.


  How Hierarchy Is Represented State Decomposition