Main Content


将独立的 Stateflow® 图作为对象在 MATLAB® 中执行

使用状态图设计逻辑,并将该逻辑作为 MATLAB 程序执行。在 Stateflow Editor 中执行图并对其进行单元测试。用图来控制用户界面和数据处理应用程序的行为。



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

Stateflow 语法



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


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.