| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Stateflow |
| Contents | Index |
| Learn more about Stateflow |
| On this page… |
|---|
Types of Coverage in Stateflow Truth Tables |
Simulink Verification and Validation software reports model coverage for the decisions the objects make in a Stateflow chart during model simulation. The report includes coverage for the decisions the truth table functions make.
| For this type of truth table... | The report includes coverage data for... |
|---|---|
| Stateflow Classic | Conditions only. |
| Embedded MATLAB | Conditions and only those actions that have decision points. |
Note To collect model coverage during simulation, you need a Simulink Verification and Validation software license. |
This section examines model coverage for a modified version of the truth table you created in Programming a Truth Table. Take the following steps to modify the truth table and generate model coverage data:
Open the model first_truth_table.

Open the truth table in the Stateflow chart for editing.
Modify the truth table:
In the Condition Table, add a decision column to the left of the existing D4 column.
The new column becomes D4 and the existing column becomes D5.
Enter - for conditions 1 and 2, enter T for condition 3, and specify action A4.
In the Action Table, create an action 6 that executes t=5 and label it A5.
The truth table logic now looks like the following, with the new rows highlighted.

Save the truth table.
In the Model Editor, select Tools > Coverage Settings.
To enable model coverage during simulation, on the Coverage tab, select Coverage for this model: first_truth_table.

Click OK to close the Coverage Settings dialog box.
In the Model Editor, change the stop time to 10 so that the simulation stops after 10 seconds.
To start the simulation, select Simulation > Start.
After the simulation completes, the software creates a model coverage report.
In the model coverage report, scroll down to the section that shows the model coverage data for the truth table ttable.

The Coverage (this object) column shows no coverage. The reason is that the container object for the truth table function—the Stateflow chart—does not decide whether to execute the ttable truth table.
The Coverage (inc. descendants) column shows coverage for the graphical function. The graphical function has the decision logic that makes the transitions for the truth table. The transitions in the graphical function contain the decisions and conditions of the truth table. Coverage for the descendants in the Coverage (inc. descendants) column includes coverage for these conditions and decisions. Function calls to the truth table test the model coverage of these conditions and decisions.
Note See How Stateflow Software Implements Truth Tables for a description of the graphical function for a truth table. |
Coverage for the decisions and their individual conditions in the ttable truth table function are as follows.
![]() | Correcting Overspecified and Underspecified Truth Tables | How Stateflow Software Implements Truth Tables | ![]() |

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 |