Main Content

Execution in MATLAB

Execute standalone Stateflow® charts as objects in MATLAB®

Design logic by using state charts and execute that logic as MATLAB programs. Execute and unit test your chart in the Stateflow editor. Control the behavior of user interfaces and data processing applications through your chart.


expand all

Stateflow.exportAsClassExport MATLAB class for standalone chart
Stateflow.exportToVersionExport standalone chart for use in previous version of Stateflow

Stateflow Syntax

expand all

Change Detection

hasChangedDetect change in data since last time step
hasChangedFromDetect change in data from specified value
hasChangedToDetect change in data to specified value

Temporal Logic

afterExecute chart after event broadcast or specified time
atExecute chart at event broadcast or specified time
countChart executions during which condition is valid
elapsedTime since state became active
everyExecute chart at regular intervals
temporalCountNumber of events, chart executions, or time since state became active


Create Stateflow Charts for Execution as MATLAB Objects

Save standalone Stateflow charts outside of Simulink® models.

Execute and Unit Test Stateflow Chart Objects

Run Stateflow charts in MATLAB or through the Stateflow Editor.

Debug a Standalone Stateflow Chart

Interrupt execution to step through each action in a Stateflow chart.

Execute Stateflow Chart Objects Through Scripts and Models

Create a MATLAB script or a Simulink model that invokes a standalone Stateflow chart.

Convert MATLAB Code into Stateflow Flow Charts

Produce flow charts from your MATLAB code.

Featured Examples