Main Content

Stateflow 编程接口

在 MATLAB® 命令提示符下创建和修改图元素

以编程方式创建和编辑 Stateflow® 图。在图中添加新对象,访问和编辑属性,设置位置,复制和粘贴对象,以及更改 Stateflow 编辑器的放大级别。

函数

全部展开

sfnew创建包含空 Stateflow 模块的 Simulink 模型
sfrootStateflow 层次结构的根
sfclipboardClipboard object
sfgcoSelected objects in chart
Stateflow.findMatchingPortIdentify matching entry or exit port (自 R2021b 起)

对象

全部展开

图、模块和状态机对象

Stateflow.ChartGraphical representation of a finite state machine
Stateflow.StateTransitionTableChartTabular representation of state machine for modal logic
Stateflow.TruthTableChartTabular representation of state machine for decision logic
Stateflow.EMChartStateflow interface to MATLAB Function block
Stateflow.MachineContainer for Stateflow blocks in a Simulink model

图形对象

Stateflow.AnnotationAnnotation in chart, state, box, or function
Stateflow.AtomicBoxAtomic box in chart, state, box, or function
Stateflow.AtomicSubchartAtomic subchart in chart, state, or box
Stateflow.BoxBox in chart, state, box, or function
Stateflow.EMFunctionMATLAB function in chart, state, box, or function
Stateflow.FunctionGraphical function in chart, state, box, or function
Stateflow.JunctionConnective or history junction in chart, state, box, or function
Stateflow.PortEntry or exit port in state or atomic subchart (自 R2021b 起)
Stateflow.SimulinkBasedStateSimulink based state in chart, state, or box
Stateflow.SLFunctionSimulink function in chart, state, box, or function
Stateflow.StateState in chart, state, or box
Stateflow.TransitionTransition in chart, state, box, or function
Stateflow.TruthTableTruth table function in chart, state, box, or function

非图形对象

Stateflow.DataData in chart, state, box, or function
Stateflow.EventEvent in chart, state, or box
Stateflow.MessageMessage in chart, state, or box

剪贴板和编辑器对象

Stateflow.ClipboardClipboard to copy and paste Stateflow objects
Stateflow.EditorGraphical aspects of a chart or state transition table

对象函数

全部展开

导航层次结构

findIdentify specified objects in hierarchy
getChildren标识对象的子级
getParent标识对象的父级
getReferencesIdentify references to symbol name
commentedByIdentify objects that implicitly comment out a graphical object
defaultTransitionsIdentify default transitions in specified object
innerTransitionsIdentify inner transitions with specified source
outerTransitionsIdentify outgoing transitions with specified source
sinkedTransitionsIdentify transitions with specified destination
sourcedTransitionsIdentify transitions with specified source

访问和修改属性

dialog打开属性对话框
exportAsStructExport contents of state transition table as structure array
renameReferencesRename symbol and update references to symbol name
setImageInsert image into annotation

控制显示

viewDisplay object in editing environment
highlight突出显示图形对象
fitToView放大图形对象
zoomInZoom in on Stateflow chart
zoomOutZoom out on Stateflow chart

原子子图以及基于 Simulink 的状态中的符号映射

getMappingForSymbolGet mapping for symbol in atomic subchart, atomic box, or Simulink based state
setMappingForSymbolSet mapping for symbol in atomic subchart, atomic box, or Simulink based state
clearMappingForSymbolClear mapping for symbol in atomic subchart, atomic box, or Simulink based state
disableMappingForSymbolDisable input event in atomic subchart or box

复制和粘贴对象

copyCopy array of objects to clipboard
pasteToPaste objects in clipboard to specified container object

转换图和状态转移表

convertToChartConvert state transition table to Stateflow chart
convertToSTTConvert Stateflow chart to state transition table

主题

精选示例