Stateflow User's Guide Previous page   Next Page

Using Subcharts to Extend Charts

Subcharts are charts within charts. They provide a convenience for compacting your diagrams. This section shows you how to create and work with subcharts in the following topics:

What Is a Subchart?

Stateflow allows you to create charts within charts. A chart that is embedded in another chart is called a subchart. The subchart can contain anything a top-level chart can, including other subcharts. In fact, you can nest subcharts to any level.

A subcharted state is a superstate of the states and charts that it contains. It appears as a block with its name in the block center. However, you can define actions and default transitions for subcharts just as you can for superstates. You can also create transitions to and from subcharts just as you can create transitions to and from superstates. Further, you can create transitions between states residing outside a subchart and any state within a subchart. The term supertransition refers to a transition that crosses subchart boundaries in this way. See Using Supertransitions to Extend Transitions for more information.

Subcharts enable you to reduce a complex chart to a set of simpler, hierarchically organized diagrams. This makes the chart easier to understand and maintain. Nor do you have to worry about changing the semantics of the chart in any way. Stateflow ignores subchart boundaries when simulating and generating code from Stateflow models.

Subcharts define a containment hierarchy within a top-level chart. A subchart or top-level chart is said to be the parent of the charts it contains at the first level and an ancestor of all the subcharts contained by its children and their descendants at lower levels.


Previous page  Changing History Junction Properties Creating a Subchart Next page

© 1994-2005 The MathWorks, Inc.