Correct Overspecified and Underspecified Truth Tables
When programming your truth table, you might program an overspecified or underspecified truth table. An overspecified truth table contains at least one true or false combination that is specified by another decision column. When this happens, the action associated with that decision column never executes. An underspecified truth table occurs when your truth table does not have enough decision columns to account for all possible true or false combinations.
By default, Stateflow® reports an error for overspecified and underspecified truth tables. To adjust the error settings for truth tables, open your truth table. After opening the truth table, in the Modeling tab, click Table Properties and change the settings for Underspecification or Overspecification.
Truth tables are not supported in standalone Stateflow charts in MATLAB®. For more information, see Use Truth Tables to Model Combinatorial Logic.
Example of an Overspecified Truth Table
An overspecified truth table contains at least one decision that never executes because a previous decision specifies it in the Condition Table. The following example shows the Condition Table of an overspecified truth table.
The decision in column D3 (
-TT) specifies the
TTT. These decisions are duplicates
of decisions D1 (
FTT) and D2
TFT). Therefore, column
D3 is an overspecification.
The following example shows the Condition Table of a truth table that appears to be overspecified, but is not.
In this case, the decision D4 specifies two decisions
FTT also appears
in decision D1, but
TTT is not a duplicate.
Therefore, this Condition Table is not overspecified.
Example of an Underspecified Truth Table
An underspecified truth table includes undefined behavior because it lacks decisions that cover every combination of the specified conditions.. The following example shows the Condition Table of an underspecified truth table.
Complete coverage of the conditions in the preceding truth table requires a Condition Table with every possible decision:
To avoid underspecification specify an action for all other possible decisions through a
default decision, named
The last decision column, D4, is the default decision for the truth table. The default decision covers any remaining decisions not tested in the preceding decision columns. See The Default Decision Column for an example and more complete description of the default decision column for a Condition Table.