Stateflow    

Create a Simulink Model

Opening the Stateflow model window is the first step toward creating a Simulink model with a Stateflow block. By default, an untitled Simulink model with an untitled, empty Stateflow block is created for you when you open the Stateflow model window. You can either start with the default empty model or copy the untitled Stateflow block into any Simulink model to include a Stateflow diagram in an existing Simulink model.

The following steps describe how to create a Simulink model with a Stateflow block, label the Stateflow block, and save the model:

  1. At the MATLAB prompt enter stateflow.
  1. Two windows are displayed. The top window is the Stateflow block library, which is as follows:

    The library contains an untitled Stateflow block icon, an Examples block, and a manual switch.

    Stateflow also displays the following untitled Simulink model window with an untitled Stateflow block.

    You only need one Stateflow block for this model. If you needed more of them, you could click-drag another block from the Stateflow block library window to the Simulink window with the left mouse button.

  1. Label the Stateflow block in the new untitled model by clicking in the text area and replacing the text Untitled with the text On_off.

  2. Save the model by choosing Save As from the File menu of the Simulink model window and entering a model title.


  Look at the Power Switch Model Create a Stateflow Diagram