Stateflow.TruthTableChart
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 a
Truth Table block in a new Simulink® model called myModel
, enter:
sfnew -TT myModel
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
and
set
functions, respectively. For more information, see Modify Properties and Call Functions of Stateflow Objects.
Content
Name
— Name of truth table
"Truth Table"
(default) | string scalar | character vector
Name of 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.
SupportVariableSizing
— Whether truth table supports variable-size data
true
or 1 (default) | false
or 0
Whether the truth table supports variable-size data, specified as a numeric or
logical 1 (true
) or 0 (false
). For more
information, see Declare Variable-Size Data in Stateflow Charts.
TreatDimensionOfLengthOneAsFixedSize
— Whether truth table treats output data with dimension of length 1 as fixed size
true
or 1
(default) | false
or 0
Since R2023a
Whether the truth table treats output 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 output 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 is false
, the
truth table treats output data as variable size if you specify the data as having
variable size.
Discrete and Continuous-Time Semantics
ChartUpdate
— Activation method for truth table
"INHERITED"
(default) | "CONTINUOUS"
| "DISCRETE"
Activation method for the truth table, specified as
"CONTINUOUS"
, "DISCRETE"
, or
"INHERITED"
.
SampleTime
— Sample time for activating truth table
"-1"
(default) | string scalar | character vector
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
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. For
more information, see Handle Integer and Enumeration Overflow for Chart Data.
TreatAsFi
— Inherited Simulink signals to treat as fi
objects
"Fixed-point"
(default) | "Fixed-point & Integer"
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.
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.
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.
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.
Hierarchy
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 truth table in model hierarchy
character vector
This property is read-only.
Location of the truth table in the model hierarchy, specified as a character vector.
Dirty
— Whether truth table has changed
true
or 1 | false
or 0
Whether the truth table has changed after being opened or saved, specified as a
numeric or logical 1 (true
) or 0 (false
).
Locked
— Whether truth table is locked
false
or 0 (default) | true
or 1
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.
Iced
— Whether truth table is locked
false
or 0 (default) | true
or 1
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
— 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.
Id
— Unique identifier
scalar
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
Create Empty Truth Table
Call the function sfnew
with the -TT
argument to open a new Simulink model that contains an empty Truth Table block.
sfnew -TT
Access the Simulink.Root
object by calling the sfroot
function.
rt = sfroot;
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 R2006aR2023a: Specify how to treat output data with dimension of length 1
With the new property TreatDimensionOfLengthOneAsFixedSize
, you can
specify how truth tables treat output data when at least one dimension has length 1. Prior
to R2023a,truth tables treat output data with a dimension of length 1 as fixed size,
regardless of whether you specify the data as having variable size.
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)