Stateflow Programmatic 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.


sfgcoRecently selected objects in chart
sfclipboardStateflow clipboard object
sfcloseClose chart
sfnewCreate model containing empty Stateflow block
sfopenOpen existing model
sfprintPrint graphical view of charts
sfrootRoot object
sfsaveSave chart in current folder
sfhelpOpen Stateflow online help
sflibOpen Stateflow library window
stateflowCreate empty chart
sfdebuggerOpen Stateflow Debugger
sfexplrOpen Model Explorer


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 method fitToView to 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

Describes how to create supertransitions

Create a MATLAB Script of API Commands

You can execute your API commands in a single MATLAB script

Was this topic helpful?