Stateflow.TruthTable
Truth table function in chart, state, box, or function
Description
Use Stateflow.TruthTable
objects to create truth table functions
that implement combinatorial logic design in a tabular format. You can use truth table
functions to model decision making for fault detection and management and mode switching. For
more information, see Use Truth Tables to Model Combinatorial Logic.
Creation
Description
Input Arguments
parent
— Parent for new truth table
Stateflow.Chart
object | Stateflow.State
object | Stateflow.Box
object | Stateflow.Function
object
Parent for the new truth table, 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 truth table
""
(default) | string scalar | character vector
Name of the truth table, specified as a string scalar or character vector.
LabelString
— Label for truth table
"?"
(default) | string scalar | character vector
Label for the truth table, specified as a string scalar or character vector.
ActionTable
— Action table
cell array of character vectors
Action table for the truth table, specified as a cell array of character vectors.
ConditionTable
— Condition table
cell array of character vectors
Condition table for the truth table, specified as a cell array of character vectors.
Language
— Action language
"MATLAB"
(default) | "C"
Action language used to program the truth table, specified as
"MATLAB"
or "C"
. The option
"C"
is supported only in truth tables in charts that use C as the
action language. For more information, see Differences Between MATLAB and C as Action Language Syntax.
IsExplicitlyCommented
— Whether to comment out truth table
false
or 0 (default) | true
or 1
Whether to comment out the truth table, specified as a numeric or logical 1
(true
) or 0 (false
). Setting this property to
true
is equivalent to right-clicking the truth table and
selecting Comment Out. For more information, see Comment Out Objects in a Stateflow Chart.
IsImplicitlyCommented
— Whether truth table is implicitly commented out
true
or 1 | false
or 0
This property is read-only.
Whether the truth table is implicitly commented out, specified as a numeric or
logical 1 (true
) or 0 (false
). The truth table
is implicitly commented out when you explicitly comment out an object that contains
it. If the truth table 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 truth table is commented out
true
or 1 | false
or 0
Since R2023a
This property is read-only.
Whether the truth table 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 truth table, 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 truth table, 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 truth table
[0 0 90 60]
(default) | [left top width height]
Position and size of the truth table, specified as a four-element numeric vector
of the form [left top width height]
.
BadIntersection
— Whether truth table intersects a box, state, or function
true
or 1 | false
or 0
This property is read-only.
Whether the truth table graphically intersects a box, state, or function,
specified as a numeric or logical 1 (true
) or 0
(false
).
FontSize
— Font size for truth table label
scalar
Font size for the truth table label, specified as a scalar. The
StateFont.Size
property of the chart that contains the truth
table sets the initial value of this property.
Debugging
OverSpecDiagnostic
— Level of diagnostic when truth table is overspecified
"Error"
(default) | "Warning"
| "None"
Level of diagnostic action when the truth table is overspecified, specified as
"Error"
, "Warning"
, or
"None"
. For more information, see Correct Overspecified and Underspecified Truth Tables.
UnderSpecDiagnostic
— Level of diagnostic when truth table is underspecified
"Error"
(default) | "Warning"
| "None"
Level of diagnostic action when the truth table is underspecified, specified as
"Error"
, "Warning"
, or
"None"
. For more information, see Correct Overspecified and Underspecified Truth Tables.
Debug
— Debugger properties
Stateflow.FunctionDebug
object
Debugger properties for the truth table, 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
).
This property applies only when both the Language
property of the truth table and the ActionLanguage
of the chart
that contains the truth table are "C"
. For more information, see
Set Breakpoints to Debug Charts.
Example: func.Debug.Breakpoints.OnDuring = true;
Integer and Fixed-Point Data
SaturateOnIntegerOverflow
— Whether data saturates on integer overflow
true
or 1 (default) | false
or 0
Whether the data in the truth table saturates on integer overflow, specified as a
numeric or logical 1 (true
) or 0 (false
). When
this property is disabled, the data in the truth table wraps on integer overflow. This
property applies only when the Language
property of the truth
table is "MATLAB"
and the ActionLanguage
of
the chart that contains the truth table is "C"
. For more
information, see Handle Integer and Enumeration Overflow for Chart Data.
EmlDefaultFimath
— Default fimath
properties
"Same as MATLAB Default"
(default) | "Other:UserSpecified"
Default fimath
properties for the truth table, specified as one
of these values:
"Same as MATLAB Default"
— Use the samefimath
properties as the current defaultfimath
object."Other:UserSpecified"
— Use theInputFimath
property to specify the defaultfimath
object.
This property applies only when the Language
property of the truth table is "MATLAB"
and the
ActionLanguage
of the chart that contains the truth table is
"C"
.
InputFimath
— Default fimath
object
string scalar | character vector
Default fimath
object, specified as a string scalar or character
vector. When the EmlDefaultFimath
property for the truth table is
"Other:UserSpecified"
, you can use this property to:
Enter an expression that constructs a
fimath
object.Enter the variable name for a
fimath
object in the MATLAB® or model workspace.
This property applies only when the Language
property of the truth table is "MATLAB"
and the
ActionLanguage
of the chart that contains the truth table is
"C"
.
Code Generation
InlineOption
— Appearance in generated code
"Auto"
(default) | "Function"
| "Inline"
Appearance of the truth table in generated code, specified as one of these values:
"Auto"
— An internal calculation determines the appearance of the truth table in generated code."Function"
— The truth table is implemented as a separate C function."Inline"
— Calls to the truth table are replaced by code as long as the truth table is not part of a recursion.
For more information, see Inline State Functions in Generated Code (Simulink Coder).
Hierarchy
Chart
— Chart that contains truth table
Stateflow.Chart
object
This property is read-only.
Chart that contains the truth table, specified as a
Stateflow.Chart
object.
Subviewer
— Subviewer for truth table
Stateflow.Chart
object | Stateflow.State
object | Stateflow.Box
object | Stateflow.Function
object
This property is read-only.
Subviewer for the truth table, 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 truth table.
Machine
— Machine that contains truth table
Stateflow.Machine
object
This property is read-only.
Machine that contains the truth table, 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 truth table in the model hierarchy, specified as a character vector.
Identification
Description
— Description
""
(default) | string scalar | character vector
Description for the truth table, specified as a string scalar or character vector.
Document
— Document link
""
(default) | string scalar | character vector
Document link for the truth table, specified as a string scalar or character vector.
Tag
— User-defined tag
[]
(default) | any data type
User-defined tag for the truth table, 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 truth table 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 |
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 Truth Table Function to Chart
Add a truth table function in the chart ch
. Set its label to
"[y1,y2] = f(x1,x2,x3)"
.
func = Stateflow.TruthTable(ch);
func.LabelString = "[y1,y2] = f(x1,x2,x3)";
Version History
Introduced before R2006aR2023a: New object functions and properties
Stateflow.TruthTable
objects have new object functions and
properties:
The object function
getReferences
returns the locations where a chart refers to the name of a truth table function.The object function
renameReferences
renames a truth table function and updates all references to the function name in the chart.The object function
commentedBy
identifies the explicitly commented objects that cause a truth table function to be commented out.The property
IsCommented
indicates whether a truth table 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 (한국어)