Truth table function in chart, state, box, or function
Use Stateflow.TruthTable objects to create truth table functions
that implement combinatorial logic design in a concise, tabular format. Typical applications
include decision making for:
Fault detection and management
Mode switching
You can call a truth table function in the actions of states and transitions. For more information, see Use Truth Tables to Model Combinatorial Logic.
parent — Parent for new truth tableStateflow.Chart object | Stateflow.State object | Stateflow.Box object | Stateflow.Function objectParent for the new truth table, specified as a Stateflow® API object of one of these types:
Name — Name of truth table'' (default) | character vectorName of the truth table, specified as a character vector.
LabelString — Full label for truth table'?' (default) | character vectorFull label for the truth table, specified as a character vector.
ActionTable — Action tableAction table for the truth table, specified as a cell array of character vectors.
ConditionTable — Condition tableCondition 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 tablefalse or 0 (default) | true or 1Whether 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 Commenting Stateflow Objects in a Chart.
IsImplicitlyCommented — Whether truth table is implicitly commented outtrue or 1 | false or 0This 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 comment out a superstate in its hierarchy.
CommentText — Comment text'' (default) | character vectorComment text added to the truth table, specified as a 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
''.
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 function intersects a box, state, or functiontrue or 1 | false or 0This 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 labelFont 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.
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.Breakpoints.OnDuring — Whether to set During Function Call breakpointfalse or 0 (default) | true or 1Whether to set the During Function Call breakpoint for the
truth table, 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'.
Example: function.Debug.Breakpoints.OnDuring =
true;
SaturateOnIntegerOverflow — Whether data saturates on integer overflowtrue or 1 (default) | false or 0Whether 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 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 same
fimath properties as the current default
fimath object.
'Other:UserSpecified' — Use the
InputFimath property to specify the default
fimath 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 objectDefault fimath object, specified as a character vector. When the
EmlDefaultFimath property for the MATLAB® function 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'.
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 function in generated code.
'Function' — The function is implemented as a separate C
function.
'Inline' — Calls to the function are replaced by
code.
For more information, see Inline State Functions in Generated Code (Simulink Coder).
Chart — Chart that contains truth tableStateflow.Chart objectThis property is read-only.
Chart that contains the truth table, specified as a
Stateflow.Chart object.
Subviewer — Subviewer for truth tableStateflow.Chart object | Stateflow.State object | Stateflow.Box object | Stateflow.Function objectThis 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 tableStateflow.Machine objectThis property is read-only.
Machine that contains the truth table, specified as a Stateflow.Machine object.
Path — Location of parent in model hierarchyThis property is read-only.
Location of the parent of the truth table in the model hierarchy, specified as a character vector.
Description — Description'' (default) | character vectorDescription for the truth table, specified as a character vector.
Document — Document link'' (default) | character vectorDocument link for the truth table, specified as a character vector.
Tag — User-defined tag[] (default) | any data typeUser-defined tag for the truth table, specified as data of any type.
SSIdNumber — Session-independent identifierThis 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 identifierThis 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.
classhandle | Provide class handle for object |
dialog | Open properties dialog box |
find | Specified objects in hierarchy |
fitToView | Zoom in on graphical object |
get | Return MATLAB structure containing property settings of object or array of objects |
highlight | Highlight graphical object |
isCommented | Determine if object is commented out |
set | Set properties with specified values |
up | Return parent of object |
view | Display object in editing environment |
Add a truth table function in the chart ch. Set its label to
'[y1,y2] = f(x1,x2,x3)'.
function = Stateflow.TruthTable(ch); function.LabelString = '[y1,y2] = f(x1,x2,x3)';
Stateflow.Box | Stateflow.Chart | Stateflow.Function | Stateflow.State