Stateflow.Function - Graphical function in chart, state, box, or function - MATLAB (original) (raw)

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

Syntax

Description

`func` = Stateflow.Function([parent](#function%5Fsep%5Fmw%5F62b5a780-fad8-49c5-adee-9aacc7de28ac)) creates a Stateflow.Function object in a parent chart, state, box, or function.

example

Input Arguments

Properties

expand all

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 andset functions, respectively. For more information, see Modify Properties and Call Functions of Stateflow Objects.

Content

Name of the graphical function, specified as a string scalar or character vector.

Label for the graphical function, specified as a string scalar or character vector.

Whether to comment out the graphical function, specified as a numeric or logical 1 (true) or 0 (false). Setting this property totrue is equivalent to right-clicking the graphical function and selecting . For more information, see Comment Out Objects in a Stateflow Chart.

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 explicitly comment out an object that contains it. If the graphical 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.

Since R2023a

This property is read-only.

Whether the graphical function is commented out, specified as a numeric or logical 1 (true) or 0 (false). This property istrue when either IsExplicitlyCommented orIsImplicitlyCommented is true.

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 tofalse, the value of CommentText reverts to"".

Graphical Appearance

Position and size of the graphical function, specified as a four-element numeric vector of the form [left top width height].

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).

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.

Whether the function is a subchart, specified as a numeric or logical 1 (true) or 0 (false).

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 istrue.

Font size for the graphical function label, specified as a scalar. TheStateFont.Size property of the chart that contains the graphical function sets the initial value of this property.

Debugging

Debugger properties for the graphical function, specified as a Stateflow.FunctionDebug object with this property:

For more information, see Set Breakpoints to Debug Charts.

Example: func.Debug.Breakpoints.OnDuring = true;

Code Generation

Appearance of the graphical function in generated code, specified as one of these values:

For more information, see Inline State Functions in Generated Code (Simulink Coder).

Hierarchy

This property is read-only.

Chart that contains the graphical function, specified as aStateflow.Chart object.

This property is read-only.

Subviewer for the graphical function, specified as aStateflow.Chart, Stateflow.State,Stateflow.Box, or Stateflow.Function object. The subviewer is the chart or subchart where you can graphically view the graphical function.

This property is read-only.

Machine that contains the graphical function, specified as a Stateflow.Machine object.

This property is read-only.

Location of the parent of the graphical function in the model hierarchy, specified as a character vector.

Identification

Description for the graphical function, specified as a string scalar or character vector.

Document link for the graphical function, specified as a string scalar or character vector.

User-defined tag for the graphical function, specified as data of any type.

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 its parent chart.

This property is read-only.

Unique identifier, specified as an integer scalar. UnlikeSSIdNumber, 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

Examples

collapse all

Add a graphical function in the chart ch. Set its label to"[y1,y2] = f(x1,x2,x3)".

func = Stateflow.Function(ch); func.LabelString = "[y1,y2] = f(x1,x2,x3)";

Version History

Introduced before R2006a

expand all

Stateflow.Function objects have new object functions and properties: