Stateflow.TruthTableChart - Tabular representation of state machine for decision logic - MATLAB (original) (raw)
Tabular representation of state machine for decision logic
Description
Use Stateflow.TruthTableChart
objects to implement combinatorial logic design in a tabular format. You can use Truth Table blocks to model decision making for fault detection and management and mode switching. For more information, see Use Truth Tables to Model Combinatorial Logic.
Creation
To create a Stateflow.TruthTableChart
object, call the function sfnew with the -TT
argument. For example, to create aTruth Table block in a new Simulink® model called myModel
, enter:
Alternatively, you can add a new Truth Table block to an existing model by using the function add_block (Simulink):
add_block("sflib/Truth Table", ... "myModel/Truth Table")
Then, to access the Stateflow.TruthTableChart
object, call the find function for the Simulink.Root
object:
table = find(sfroot,"-isa","Stateflow.TruthTableChart", ... Path="myModel/Truth Table");
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
andset
functions, respectively. For more information, see Modify Properties and Call Functions of Stateflow Objects.
Content
Name of the truth table, specified as a string scalar or character vector.
Action table for the truth table, specified as a cell array of character vectors.
Condition table for the truth table, specified as a cell array of character vectors.
Since R2023a
Whether the truth table treats non-scalar data with a dimension of length 1 as fixed size, specified as a numeric or logical 0
(false
) or 1
(true
). When this property is true
, the truth table treats non-scalar data that have at least one dimension of length 1 as fixed size, regardless of whether you specify the data as having variable size. When this property isfalse
, the truth table treats non-scalar data as variable size if you specify the data as having variable size.
Discrete and Continuous-Time Semantics
Activation method for the truth table, specified as"CONTINUOUS"
, "DISCRETE"
, or"INHERITED"
.
Sample time for activating the truth table, specified as a string scalar or character vector. This property applies only when the ChartUpdate
property for the truth table is "DISCRETE"
.
Integer and Fixed-Point Data
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. For more information, see Handle Integer and Enumeration Overflow for Chart Data.
Inherited Simulink signals to treat as Fixed-Point Designer™fi
objects, specified as one of these values:
"Fixed-point"
— The truth table treats all fixed-point inputs asfi
objects."Fixed-point & Integer"
— The truth table treats all fixed-point and integer inputs asfi
objects.
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.
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.
Debugging
Hierarchy
This property is read-only.
Machine that contains the truth table, specified as a Stateflow.Machine object.
This property is read-only.
Location of the truth table in the model hierarchy, specified as a character vector.
Whether the truth table has changed after being opened or saved, specified as a numeric or logical 1 (true
) or 0 (false
).
Whether the truth table is locked, specified as a numeric or logical 1 (true
) or 0 (false
). Enable this property to prevent changes in the truth table.
This property is read-only.
Whether the truth table is locked, specified as a numeric or logical 1 (true
) or 0 (false
). This property is equivalent to the property Locked
, but is used internally to prevent changes in the truth table during simulation.
Identification
Description for the truth table, specified as a string scalar or character vector.
Document link for the truth table, specified as a string scalar or character vector.
User-defined tag for the truth table, specified as data of any type.
This property is read-only.
Unique identifier, specified as an integer scalar. Use this property to distinguish the truth table from other objects in the model. 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 |
dialog | Open properties dialog box |
view | Display object in editing environment |
Examples
Call the function sfnew with the -TT
argument to open a new Simulink model that contains an empty Truth Table block.
Access the Simulink.Root
object by calling the sfroot function.
Access the Stateflow.TruthTableChart
object by calling the find function for the Simulink.Root
object.
table = find(rt,"-isa","Stateflow.TruthTableChart");
Version History
Introduced before R2006a
With the new property [TreatDimensionOfLengthOneAsFixedSize](stateflow.truthtablechart.html#mw%5Fd548fd2a-8d30-44b2-a535-0df47fb51149)
, you can specify how truth tables treat non-scalar data when at least one dimension has length 1. Prior to R2023a, truth tables treated non-scalar data with a dimension of length 1 as fixed size, regardless of whether you specified the data as having variable size.