| Contents | Index |
To create a new Stateflow chart, follow these steps:
Enter sfnew or stateflow at the MATLAB command prompt to create a new empty model with a chart.

The stateflow command also displays the Stateflow block library.

You can drag and drop additional charts in your Simulink system from this library if you want to create multiple charts in your model. You can also drag and drop new charts into existing systems from the Stateflow library in the Simulink Library Browser. For information on creating your own chart libraries, see Creating Specialized Chart Libraries for Large-Scale Modeling.
Open the chart by double-clicking the Chart block.
The empty chart appears in the editor.

Open the Chart properties dialog box.
In the Chart properties dialog box, select a chart type from the drop-down menu in the State Machine Type field:
| Type | Description |
|---|---|
| Classic | The default machine type. Provides the full set of Stateflow chart semantics (see Stateflow Chart Semantics). |
| Mealy | Machine type in which output is a function of inputs and state. |
| Moore | Machine type in which output is a function only of state. |
Mealy and Moore charts use a subset of Stateflow chart semantics. For more information, see Building Mealy and Moore Charts.
In the Chart properties dialog box, select an update method for the chart in the Update method field.
This value determines when and how often the chart is called during the execution of the Simulink model.
Use the Stateflow Editor to draw a Stateflow chart.
See Editor Operations and the rest of this chapter for more information on how to draw Stateflow charts.
Interface the chart to other blocks in your Simulink model, using events and data.
See Defining Events, Defining Data, and Defining Interfaces to Simulink Models and the MATLAB Workspace for more information.
Rename and save the model by selecting Save Model As from the Stateflow Editor menu or Save As from the Simulink menu.
![]() | Basic Workflow for Building a State Chart | Working with States in Charts | ![]() |

Learn how engineers use Stateflow to model state machines in their Simulink models.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |