Main Content

Set Simulink Based State Properties

Simulink® based states are Simulink subsystems within a Stateflow® state that enable you to model systems that switch between periodic or continuous time dynamics. For more information, see Simulink Subsystems as States.

You can specify properties for a Simulink based state in the Property Inspector, the Model Explorer, or the Simulink based state properties dialog box.

To use the Property Inspector:

  1. In the Modeling tab, under Design Data, select Property Inspector.

  2. In the Stateflow Editor, select the Simulink based state.

  3. In the Property Inspector, edit the properties of the Simulink based state.

To use the Model Explorer:

  1. In the Modeling tab, under Design Data, select Model Explorer.

  2. In the Model Hierarchy pane, select the Simulink based state.

  3. In the Dialog pane, edit the properties of the Simulink based state.

To use the Simulink Based State properties dialog box:

  1. In the Stateflow Editor, right-click the Simulink based state.

  2. Select Properties.

  3. In the properties dialog box, edit the Simulink based state properties.

You can also specify Simulink based state properties programmatically by using Stateflow.SimulinkBasedState objects. For more information about the Stateflow programmatic interface, see Overview of the Stateflow API.

Simulink Based State Properties

Create data for monitoring self activity

Creates a data output port on the Stateflow block for this self-activity of the state.

Log self activity

Logs the state self-activity. View the activity of the state in the Simulation Data Inspector.

Logging name

Specify the signal logging name. To create a signal logging name that is different from the state name, choose Custom, and add the name.

Test point

Sets the Simulink based state as a Stateflow test point. For more information, see Monitor Test Points in Stateflow Charts.

Limit data points to last

Maximum number of data points to log. Default value is 5000, which means the chart logs the last 5000 data points generated by the simulation.


Decimation interval limits the amount of data logged by skipping samples. Default value is 2, which means the chart logs every other sample.

Function packaging

Specify the code format generated for a Simulink based state. You can set the format to one of these options:

  • AutoSimulink Coder™ software chooses the optimal format for you based on the type and number of instances of the subsystem that exist in the model.

  • InlineSimulink Coder software inlines the subsystem unconditionally.

  • Nonreusable functionSimulink Coder software explicitly generates a separate function in a separate file.

  • Reusable functionSimulink Coder software generates a function with arguments that allows reuse of Simulink based state code when a model includes multiple instances of the Simulink based state.

For more information, see the Function Packaging parameter in the Subsystem (Simulink) block.


Description of the Simulink based state.

Document Link

Link to online documentation for the Simulink based state. You can enter a web URL address or a MATLAB® command that displays documentation as an HTML file or as text in the MATLAB Command Window. When you click the Document link hyperlink, Stateflow evaluates the link and displays the documentation.

See Also



Related Topics