| Stateflow® | ![]() |
| On this page… |
|---|
This section describes the operations you can perform in the Truth Table Editor.
| Edit Data/Ports lets you add or modify Stateflow data with the Model Explorer. |
| Append Column adds a column on the right end of the selected table. |
| Append Row adds a row to the bottom of the selected table. |
| Compact Table removes the empty rows and columns of the selected table. |
To delete the contents of a cell:
To delete an entire row or column:
From the context menu, select Delete Row or Delete Column.
You can also click the row or column header to select the entire row or column and press the Delete key.
| Run Diagnostics checks the truth table for syntax errors. See Debugging a Truth Table. |
| View Generated Content displays the code generated for the truth table. Stateflow Classic truth tables generate graphical functions; Embedded MATLAB truth tables generate Embedded MATLAB code. See How Stateflow Software Implements Truth Tables. |
Both the default Condition Table and the default Action Table have one empty row. Click a cell to edit its text contents. Use Tab and Shift+Tab to move horizontally between cells. To add rows and columns to either table, see Appending Rows and Columns .
You set the Truth Table Editor to display only one of the two tables by double-clicking the header of the table to display. To revert to the display of both tables, double-click the header of the displayed table.
Cells for the numbered rows in decision columns like D1 can take values of T, F, or -. Once you select one of these cells, you can use the spacebar to step through the T, F, and - values. In these cells you can use the left, right, up, and down arrow keys to advance to another cell in any direction.
To insert a blank row above an existing table row:
To insert a blank decision column to the left of an existing decision column:
To move a condition or action row up or down:
Click the row header to select the row.
Drag the row to a new position.
The Truth Table Editor renumbers the rows automatically.
To move a decision column up or down:
Click the column header to select the column.
Drag the column to a new position.
The Truth Table Editor renumbers the decision columns automatically.
| Print makes a printed copy or an online viewable copy (HTML file) of the truth table. |
To select a cell for editing, click the cell.
To select text in a cell, click and drag your pointer over the text.
To select a row, click the header for the row.
To select a decision column in the Condition Table, click the column header (D1, D2, and so on).
To deselect a selected cell, row, or column, press Esc, or click another table, cell, row, or column.
| Select the Undo tool or press Ctrl+Z (Command+Z) to reverse the effects of the preceding operation. |
| Select the Redo tool or press Ctrl+Y (Command+Y) to reverse the effects of the most recently undone edit operation. |
| Go to Stateflow Editor displays the current truth table function in its native Stateflow chart. |
You can use the Search & Replace tool to search for text in the Description, Condition, and Action columns of a truth table and replace it with a substitute string.
Suppose you want to search a model for the string x is equal to and replace it with the string x equals. Follow these steps:
In the Stateflow Editor, select Search & Replace from the Tools menu.
In the Search & Replace dialog box, enter the text x is equal to in the Search field, and the text x equals in the Replace field.
You see something like this in the Search & Replace window.

In the Viewer pane of the Search & Replace window, the first occurrence of the string x is equal to is highlighted normally and the other matches are highlighted lightly.
Select Replace All to replace all matches in the model (not just in the truth table) with x equals.
Note For more information, see Using the Stateflow Search & Replace Tool. |
Row and column header tooltips appear to aid truth table navigation when you scroll to other columns or rows while editing a large truth table. When you place your pointer over row or column headers, these tooltips appear:
Table | Row or Column | Tooltip |
|---|---|---|
Condition | Condition row | Condition entered for this row |
Condition | Decision column (D1, D2,...) | Row or label entered for this decision in the Actions row |
Condition | Actions row | Actions: specify a row from the Action Table |
Action | Any row | Description entered for this action |
![]() | How Stateflow Software Implements Truth Tables | Using Embedded MATLAB Functions in Stateflow Charts | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |