Stateflow User's Guide Previous page   Next Page

Entering Truth Table Decisions

Each decision column (D1, D2, and so on) binds a group of condition outcomes together with an AND relationship into a decision. The allowed values for the condition outcomes in a decision are T (true), F (false), and - (true or false). In Entering Truth Table Conditions you enter conditions for the truth table ttable in the truth table editor. Continue by entering decisions in the decision columns with the following steps:

  1. Click anywhere in the Condition Table to make sure it is selected.
  2. Click the Append Column toolbar button three times to add three columns to the right end of the Condition Table for a total of four as shown.

  3. Click the top cell in decision column D1.
  1. The cell is highlighted and a flashing text cursor appears in the cell.

  1. Press the space bar once to enter a value of T.
  1. Pressing the space bar toggles through the possible values of F, -, and T. You can also enter these characters directly. All other entries are rejected.

  1. Press the down arrow key to advance to the next cell down in the D1 column.
  1. In the decision columns, you can use the arrow keys to advance to another cell in any direction. You can also use Tab and Shift+Tab to advance left or right in these cells.

  1. Enter the remaining values for the decision columns, as shown in the following:

During execution of the truth table, decisions are tested in left to right order. The order of testing for individual condition outcomes within a decision is undefined. The current implementation of truth tables in Stateflow evaluates the conditions for each decision in top-down order (first condition 1, then condition 2, and so on). Because this implementation is subject to change in the future, you must not depend on a particular evaluation order.

The Default Decision Column

The last decision column in ttable, D4, is the default decision for this truth table. The default decision covers any remaining decisions not tested for in preceding decision columns to the left. You enter a default decision as the last decision column on the right with an entry of - for all conditions in the decision, where - represents any outcome for the condition.

In the preceding example, the following decisions are specified by the default decision column, D4:

Condition
Decision 4
Decision 5
Decision 6
Decision 7
Decision 8
x == 1
F
T
F
T
T
y == 1
F
F
T
T
T
z == 1
F
T
T
F
T


Previous page  Entering Truth Table Conditions Entering Truth Table Actions Next page

© 1994-2005 The MathWorks, Inc.