Stateflow.Function
Graphical function in chart, state, box, or function
Description
Use Stateflow.Function
objects to create graphical functions that
contain control-flow logic and iterative loops. You create graphical functions with flow
charts that use connective junctions and transitions. You can call a graphical function in the
actions of states and transitions. For more information, see Reuse Logic Patterns by Defining Graphical Functions.
Creation
Description
Input Arguments
parent
— Parent for new graphical function
Stateflow.Chart
object | Stateflow.State
object | Stateflow.Box
object | Stateflow.Function
object
Parent for the new graphical function, specified as a Stateflow® API object of one of these types:
Stateflow.Function
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 graphical function
""
(default) | string scalar | character vector
Name of the graphical function, specified as a string scalar or character vector.
LabelString
— Label for graphical function
"?"
(default) | string scalar | character vector
Label for the graphical function, specified as a string scalar or character vector.
IsExplicitlyCommented
— Whether to comment out graphical function
false
or 0 (default) | true
or 1
Whether to comment out the graphical function, specified as a numeric or logical 1
(true
) or 0 (false
). Setting this property to
true
is equivalent to right-clicking the graphical function and
selecting Comment Out. For more information, see Comment Out Objects in a Stateflow Chart.
IsImplicitlyCommented
— Whether graphical function is implicitly commented out
true
or 1 | false
or 0
This property is read-only.
Whether the graphical function is implicitly commented out, specified as a numeric
or logical 1 (true
) or 0 (false
). The graphical
function is implicitly commented out when you comment out a state, box, or function
that contains it.
CommentText
— Comment text
""
(default) | string scalar | character vector
Comment text for the graphical 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 graphical 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 graphical function
[0 0 90 60]
(default) | [left top width height]
Position and size of the graphical function, specified as a four-element numeric vector of
the form [left top width height]
.
BadIntersection
— Whether graphical function intersects a box, state, or function
true
or 1 | false
or 0
This property is read-only.
Whether the graphical function graphically intersects a box, state, or function,
specified as a numeric or logical 1 (true
) or 0
(false
).
IsGrouped
— Whether graphical function is a grouped function
false
or 0 (default) | true
or 1
Whether the function is a grouped function, specified as a numeric or logical 1
(true
) or 0 (false
). When you copy and paste a
grouped function, you copy not only the function but all of its contents. For more
information, see Copy and Paste by Grouping.
IsSubchart
— Whether graphical function is a subchart
false
or 0 (default) | true
or 1
Whether the function is a subchart, specified as a numeric or logical 1
(true
) or 0 (false
).
ContentPreviewEnabled
— Whether to display preview of graphical function contents
false
or 0 (default) | true
or 1
Whether to display a preview of the graphical function contents, specified as a
numeric or logical 1 (true
) or 0 (false
). This
property applies only when the IsSubchart
property is
true
.
FontSize
— Font size for graphical function label
scalar
Font size for the graphical function label, specified as a scalar. The
StateFont.Size
property of the chart that contains the
graphical function sets the initial value of this property.
Debugging
Debug
— Debugger properties
Stateflow.FunctionDebug
object
Debugger properties for the graphical function, specified as a Stateflow.FunctionDebug
object
with this property:
Breakpoints.OnDuring
— Whether to set theDuring Function Call
breakpoint, specified as a numeric or logical 1 (true
) or 0 (false
).
For more information, see Set Breakpoints to Debug Charts.
Example: function.Debug.Breakpoints.OnDuring =
true;
Code Generation
InlineOption
— Appearance in generated code
"Auto"
(default) | "Function"
| "Inline"
Appearance of the graphical function in generated code, specified as one of these values:
"Auto"
— An internal calculation determines the appearance of the function in generated code."Function"
— The function is implemented as a separate C function."Inline"
— Calls to the function are replaced by code as long as the function is not part of a recursion.
For more information, see Inline State Functions in Generated Code (Simulink Coder).
Hierarchy
Chart
— Chart that contains graphical function
Stateflow.Chart
object
This property is read-only.
Chart that contains the graphical function, specified as a
Stateflow.Chart
object.
Subviewer
— Subviewer for graphical function
Stateflow.Chart
object | Stateflow.State
object | Stateflow.Box
object | Stateflow.Function
object
This property is read-only.
Subviewer for the graphical 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 graphical
function.
Machine
— Machine that contains graphical function
Stateflow.Machine
object
This property is read-only.
Machine that contains the graphical 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 graphical function in the model hierarchy, specified as a character vector.
Identification
Description
— Description
""
(default) | string scalar | character vector
Description for the graphical function, specified as a string scalar or character vector.
Document
— Document link
""
(default) | string scalar | character vector
Document link for the graphical function, specified as a string scalar or character vector.
Tag
— User-defined tag
[]
(default) | any data type
User-defined tag for the graphical 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 graphical function from other objects in the model.
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 |
defaultTransitions | Identify default transitions in specified object |
dialog | Open properties dialog box |
isCommented | Determine if graphical object is commented out |
view | Display object in editing environment |
highlight | Highlight graphical object |
fitToView | Zoom in on graphical object |
Examples
Add Graphical Function to Chart
Add a graphical function in the chart ch
. Set its label to
"[y1,y2] = f(x1,x2,x3)"
.
function = Stateflow.Function(ch); function.LabelString = "[y1,y2] = f(x1,x2,x3)";
Version History
Introduced before R2006a
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
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)