本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

状态和转移的语法

通过使用动作和条件来表达图行为

通过指定状态转移时间以及动作执行时间来控制 Stateflow® 图的执行。通过广播事件同步状态执行。检测数据值的变化,并检查在图执行期间有哪些状态为活动状态。

模块

ChartImplement control logic with finite state machine

Stateflow 语法

全部展开

更改检测

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

时序逻辑

afterControl chart execution with the after operator
atControl chart execution with the at operator
beforeControl chart execution with the before operator
countControl chart execution with the count operator
durationControl chart execution with the duration operator
elapsedControl chart execution with the elapsed operator
everyControl chart execution with the every operator
temporalCountControl chart execution with the temporalCount operator

主题

状态动作类型

指定当状态处于激活状态时要执行的动作。

转移动作的类型

将触发器、条件和动作添加到转移。

Eliminate Redundant Code by Combining State Actions

Combine entry, during, and exit actions in a state.

Control Function-Call Subsystems by Using bind Actions

Bind a function-call output event to the activity of a state.

支持的 Stateflow 图数据运算

在 Stateflow 图中执行数学计算。

Supported Symbols in Actions

Special symbols available for state and transition actions.

Call Extrinsic MATLAB Functions in Stateflow Charts

Access MATLAB® functions that are not supported for code generation.

Access MATLAB Functions and Workspace Data in C Charts

Call built-in MATLAB functions by using the ml operator.

在 C 语言状态图中调用 C 库函数

在状态和转移标签中访问 C 函数。

Check State Activity by Using the in Operator

Determine if a state is active during chart execution.

检测数据值更改

定义数据更改值时的图行为。

使用时序逻辑控制图的执行

使用基于事件的和绝对时间的时序逻辑运算符。

Define Chart Behavior by Using Implicit Events

Trigger chart actions by changes in data values and state activity.

Control Oscillations by Using the duration Operator

Simplify debouncing logic in charts that have transient signals.

Count Events by Using the temporalCount Operator

Count occurrences of explicit and implicit events.

特色示例