Documentation

StateflowProgrammatic Interface

Use the API for creating, deleting, finding, and modifying chart elements

You can create, edit, and simulate your Stateflow®charts with MATLAB®commands. Access and edit the properties and methods, set positions, or copy and paste objects in your chart. Edit graphical properties by accessing the editor object.

Functions

expand all

sfgco Recently selected objects in chart
sfclipboard Stateflow clipboard object
sfclose Close chart
sfnew Create model containing empty Stateflow block
sfopen Open existing model
sfprint Print graphical view of charts
sfroot Root object
sfsave Save chart in current folder
sfhelp Open Stateflow online help
sflib Open Stateflow library window
stateflow Create empty chart
sfdebugger Open Stateflow Debugger
sfexplr Open Model Explorer

Methods

expand all

defaultTransitions Return default transitions in object at top level of containment
disp Display properties and settings for object
find Return specified objects
get Return MATLAB structure containing property settings of object or array of objects
help Display list of properties for object with accompanying descriptions
innerTransitions Return inner transitions that originate with chart or state and terminate on contained object
methods List methods belonging to object
outerTransitions Return array of outer transitions for object
set Set properties with specified values
sinkedTransitions Return transitions that have object as destination
sourcedTransitions Return transitions that have object as source
struct Return MATLAB structure containing property settings of object
copy Copy specified array of objects to clipboard
delete Delete object
pasteTo Paste objects in clipboard to specified container object
setImage Insert image from clipboard or image file into an annotation
Stateflow.Annotation Constructor for creating note
Stateflow.AtomicBox Constructor for creating atomic box
Stateflow.AtomicSubchart Constructor for creating atomic subchart
Stateflow.Box Constructor for creating box
Stateflow.Data Constructor for creating data
Stateflow.EMFunction Constructor for creating MATLAB function
Stateflow.Event Constructor for creating event
Stateflow.Function Constructor for creating graphical function
Stateflow.Junction Constructor for creating junction
Stateflow.SimulinkBasedState Constructor for creating a Simulink based state
Stateflow.SLFunction Constructor for creating Simulink function
Stateflow.State Constructor for creating state
Stateflow.Transition Constructor for creating transition
Stateflow.TruthTable Constructor for creating truth table
dialog Open properties dialog box of object
fitToView Zoom in on graphical Stateflow object
highlight Highlight graphical object in chart
view Make object visible for editing
zoomIn and zoomOut Zoom in or out on Stateflow chart
classhandle Provide handle to schema class of object type
isCommented Determine if object is commented out
outputData Create, retrieve, or delete data output to Simulink base workspace of state activity status
parse Parse single chart or all charts in model
up Return parent of object

Topics

Overview of the Stateflow API

Create an edit Stateflow chart using basic commands of the API.

Properties and Methods Sorted By Chart Object

Sorts API properties and methods by object

Properties and Methods Sorted Alphabetically By Application

Sorts properties and methods alphabetically by application

Create and Access Charts Using the Stateflow API

Construct a Stateflow chart with the Stateflow API

Access the Properties and Methods of Objects

Describes the conventions used in naming the properties and methods of Stateflow API objects and the rules for using them in commands

Display Properties and Methods

Information on calling built-in methods for listing properties and methods for each object type

Create and Destroy API Objects

Information on creating and destroying any Stateflow object with the Stateflow API, and how to connect one object with another

Access Existing Stateflow Objects

Create handles to Stateflow objects and manipulate objects in a chart

Move Graphical Objects

Programmatically reposition chart states and subcharts.

Copy Objects

Learn the copy and paste procedure for copying Stateflow objects from one environment to another

Zoom a Chart Object Using the API

Use the Stateflow API methodfitToViewto zoom in on a graphical object in the chart.

Access Graphical Properties and Methods Using the Editor Object

Access the Editor object for a Stateflow chart to perform operations that are graphical only, such as changing fonts and colors

Enter Multiline Labels

The Stateflow API provides two techniques to enter text with more than one line for the labels of states and transitions

Create Default Transitions

The Stateflow API provides two means for making default transitions

Make Supertransitions

描述如何create supertransitions

Create a MATLAB Script of API Commands

You can execute your API commands in a single MATLAB script

Was this topic helpful?