Stateflow.SLFunction
Simulink function in chart, state, box, or function
Description
Use Stateflow.SLFunction
objects to create Simulink® functions that enable you to call Simulink subsystems in the actions of states and transitions. Typical applications
include:
Defining a function that requires Simulink blocks
Scheduling execution of multiple controllers
For more information, see Reuse Simulink Functions in Stateflow Charts.
Creation
Description
Input Arguments
parent
— Parent for new Simulink function
Stateflow.Chart
object | Stateflow.State
object | Stateflow.Box
object | Stateflow.Function
object
Parent for the new Simulink function, specified as a Stateflow® API object of one of these types:
Properties
Stateflow API objects have properties that correspond to the values you set in the Stateflow
Editor. To access or modify a property, use dot notation. To access or modify multiple
properties for multiple API objects, use the get
and
set
functions, respectively. For more information, see Modify Properties and Call Functions of Stateflow Objects.
Content
Name
— Name of Simulink function
""
(default) | string scalar | character vector
Name of the Simulink function, specified as a string scalar or character vector.
LabelString
— Label for Simulink function
"?"
(default) | string scalar | character vector
Label for the Simulink function, specified as a string scalar or character vector.
IsExplicitlyCommented
— Whether to comment out Simulink function
false
or 0 (default) | true
or 1
Whether to comment out the Simulink function, specified as a numeric or logical 1 (true
)
or 0 (false
). Setting this property to true
is
equivalent to right-clicking the Simulink function and selecting Comment Out. For more
information, see Comment Out Objects in a Stateflow Chart.
IsImplicitlyCommented
— Whether Simulink function is implicitly commented out
true
or 1 | false
or 0
This property is read-only.
Whether the Simulink function is implicitly commented out, specified as a numeric or logical
1 (true
) or 0 (false
). The Simulink function is implicitly commented out when you explicitly comment out an
object that contains it. If the Simulink function is contained in an atomic subchart or an atomic box, this
property is false
unless the explicitly commented object is also
contained in the atomic subchart or atomic box.
IsCommented
— Whether Simulink function is commented out
true
or 1 | false
or 0
Since R2023a
This property is read-only.
Whether the Simulink function is commented out, specified as a numeric or logical 1
(true
) or 0 (false
). This property is
true
when either IsExplicitlyCommented
or
IsImplicitlyCommented
is true
.
CommentText
— Comment text
""
(default) | string scalar | character vector
Comment text added to the Simulink function, specified as a string scalar or character vector. This
property applies only when the IsExplicitlyCommented
property is
true
. In the Stateflow Editor, when you point to the comment badge on the Simulink function, the text appears as a tooltip. When you set the
IsExplicitlyCommented
property to false
, the
value of CommentText
reverts to ""
.
Graphical Appearance
Position
— Position and size of Simulink function
[0 0 90 60]
(default) | [left top width height]
Position and size of the Simulink function, specified as a four-element numeric vector of
the form [left top width height]
.
BadIntersection
— Whether Simulink function intersects a box, state, or function
true
or 1 | false
or 0
This property is read-only.
Whether the Simulink function graphically intersects a box, state, or function, specified as
a numeric or logical 1 (true
) or 0
(false
).
ContentPreviewEnabled
— Whether to display preview of Simulink function contents
true
or 1 (default) | false
or 0
Whether to display a preview of the Simulink function contents, specified as a numeric or logical 1
(true
) or 0 (false
).
FontSize
— Font size for Simulink function label
scalar
Font size for the Simulink function label, specified as a scalar. The
StateFont.Size
property of the chart that contains the
Simulink function sets the initial value of this property.
Hierarchy
Chart
— Chart that contains Simulink function
Stateflow.Chart
object
This property is read-only.
Chart that contains the Simulink function, specified as a
Stateflow.Chart
object.
Subviewer
— Subviewer for Simulink function
Stateflow.Chart
object | Stateflow.State
object | Stateflow.Box
object | Stateflow.Function
object
This property is read-only.
Subviewer for the Simulink function, specified as a Stateflow.Chart
,
Stateflow.State
, Stateflow.Box
, or
Stateflow.Function
object. The subviewer is the chart or subchart
where you can graphically view the Simulink function.
Machine
— Machine that contains Simulink function
Stateflow.Machine
object
This property is read-only.
Machine that contains the Simulink function, specified as a Stateflow.Machine
object.
Path
— Location of parent in model hierarchy
character vector
This property is read-only.
Location of the parent of the Simulink function in the model hierarchy, specified as a character vector.
Identification
Description
— Description
""
(default) | string scalar | character vector
Description for the Simulink function, specified as a string scalar or character vector.
Document
— Document link
""
(default) | string scalar | character vector
Document link for the Simulink function, specified as a string scalar or character vector.
Tag
— User-defined tag
[]
(default) | any data type
User-defined tag for the Simulink function, specified as data of any type.
SSIdNumber
— Session-independent identifier
scalar
This property is read-only.
Session-independent identifier, specified as an integer scalar. Use this property to distinguish the Simulink function from other objects in its parent chart.
Id
— Unique identifier
scalar
This property is read-only.
Unique identifier, specified as an integer scalar. Unlike
SSIdNumber
, the value of this property is reassigned every time
you start a new MATLAB® session and may be recycled after an object is deleted.
Object Functions
find | Identify specified objects in hierarchy |
getChildren | Identify children of object |
getParent | Identify parent of object |
getReferences | Identify references to symbol name |
renameReferences | Rename symbol and update references to symbol name |
commentedBy | Identify objects that implicitly comment out a graphical object |
dialog | Open properties dialog box |
view | Display object in editing environment |
highlight | Highlight graphical object |
fitToView | Zoom in on graphical object |
Examples
Add Simulink Function to Chart
Add a Simulink function in the chart ch
. Set its label to
"[y1,y2] = f(x1,x2,x3)"
.
func = Stateflow.SLFunction(ch);
func.LabelString = "[y1,y2] = f(x1,x2,x3)";
Version History
Introduced in R2008bR2023a: New object functions and properties
Stateflow.SLFunction
objects have new object functions and properties:
The object function
getReferences
returns the locations where a chart refers to the name of a Simulink function.The object function
renameReferences
renames a Simulink function and updates all references to the function name in the chart.The object function
commentedBy
identifies the explicitly commented objects that cause a Simulink function to be commented out.The property
IsCommented
indicates whether a Simulink function is commented out. This property replaces the object functionisCommented
.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)