Stateflow User's Guide Previous page   Next Page

Adding Initial and Final Actions

In addition to the actions for decisions, Stateflow also lets you add initial and final actions to the truth table function. Initial actions specify an action that executes before any decisions are tested. Final actions specify an action that executes as the last action before the truth table is exited. To specify initial and final actions for a truth table, use the action labels INIT and FINAL in the Action Table.

Use the following procedure to add initial and final actions to display diagnostic messages in the MATLAB Command Window before and after the execution of the truth table ttable:

  1. In the truth table editor for the truth table ttable, right-click row 1 of the Action Table.
  1. A pop-up menu appears.

  1. From the pop-up menu, select Insert Row.
  1. A blank row is inserted at the beginning of the Action Table.

  1. Click the Append Row tool .
  1. A blank row is appended to the bottom of the Action Table.

  1. Click and drag the bottom border of the truth table editor to expose all six rows of the Action Table, as shown.

  2. Edit the contents of rows 1 and 6 of the Action Table, as shown in the following:

  1. In the Action Table, click and drag the right border of the Action column to increase its size as needed.

Even though the initial and final actions for the preceding truth table example are shown in the first and last rows of the Action Table, you can enter these actions in any row. You can also explicitly assign the initial and final actions to decisions by using the action specifier INIT or FINAL in the Actions row of the Condition Table.


Previous page  Assigning Truth Table Actions to Decisions Debugging a Truth Table Next page

© 1994-2005 The MathWorks, Inc.