Products & Services Industries Academia Support User Community Company

Learn more about Stateflow   

Truth Table Editor Operations

Truth Table Editor Reference

This section describes the operations you can perform in the Truth Table Editor.

Adding or Modifying Stateflow Data

Edit Data/Ports opens the Model Explorer so that you can add or modify Stateflow data.

Appending Rows and Columns

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.

Compacting the Table

Compact Table removes the empty rows and columns of the selected table.

Deleting Text, Rows, and Columns

To delete the contents of a cell:

  1. Right-click the cell.

  2. From the context menu, select Delete Cell.

To delete an entire row or column:

  1. Right-click the row or column header.

  2. 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.

Diagnosing the Truth Table

Run Diagnostics checks the truth table for syntax errors. See Debugging a Truth Table.

Viewing Generated Content

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. For details, see How Stateflow Software Implements Truth Tables.

Editing 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.

Inserting Rows and Columns

To insert a blank row above an existing table row:

  1. Right-click any cell in the row (including the row header).

  2. From the context menu, select Insert Row.

To insert a blank decision column to the left of an existing decision column:

  1. Right-click any cell in the existing decision column (including the column header).

  2. From the context menu, select Insert Column.

Moving Rows and Columns

To move a condition or action row up or down:

  1. Click the row header to select the row.

  2. Drag the row to a new position.

    The Truth Table Editor renumbers the rows automatically.

To move a decision column left or right:

  1. Click the column header to select the column.

  2. Drag the column to a new position.

    The Truth Table Editor renumbers the decision columns automatically.

Printing Tables

Print makes a printed copy or an online viewable copy (HTML file) of the truth table.

Selecting and Deselecting Table Elements

To...Perform this action...
Select a cell for editingClick the cell
Select text in a cellClick and drag your pointer over the text
Select a rowClick the header for the row
Select a decision column in the Condition TableClick the header for the column
Deselect a selected cell, row, or columnPress Esc or click another table, cell, row, or column

Undoing and Redoing Edit Operations

Click the Undo button or press Ctrl+Z (Command+Z) to undo the effects of the preceding operation.

Click the Redo button or press Ctrl+Y (Command+Y) to redo the most recently undone operation.

Viewing the Stateflow Chart for the Truth Table

Go to Stateflow Editor displays the current truth table function in its native Stateflow chart.

Searching and Replacing Text in Truth Tables

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.

A Simple Example

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:

  1. In the Stateflow Editor, select Tools > Search & Replace.

  2. In the Search & Replace dialog box, enter the text x is equal to in the Search for field, and the text x equals in the Replace with field.

  3. Click the Search button.

    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 other matches are highlighted lightly.

  4. Click Replace to replace the first match with x equals.

  5. Click Replace all to replace all matches in the model (not just in the truth table) with x equals.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS