Skip to Main Content Skip to Search
Product Documentation

Creating an Empty State Chart

To create a new Stateflow chart, follow these steps:

  1. 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.

  2. Open the chart by double-clicking the Chart block.

    The empty chart appears in the editor.

  3. Open the Chart properties dialog box.

    See Setting Properties for a Single Chart.

  4. In the Chart properties dialog box, select a chart type from the drop-down menu in the State Machine Type field:

    TypeDescription
    ClassicThe default machine type. Provides the full set of Stateflow chart semantics (see Stateflow Chart Semantics).
    MealyMachine type in which output is a function of inputs and state.
    MooreMachine 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.

  5. 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.

  6. 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.

  7. 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.

  8. Rename and save the model by selecting Save Model As from the Stateflow Editor menu or Save As from the Simulink menu.

      Note   Trying to save a model with more than 25 characters produces an error. Loading a model with more than 25 characters produces a warning.

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS