Basic Operation of the Model Coverage Tool
This example shows how to use the Configuration Parameters dialog to enable coverage for a Simulink® model and adjust the type of information that is reported.
Open Example Model
The sldemo_clutch example model that ships with Simulink provides a good introduction to model coverage. This model contains several blocks that have intrinsic decisions, places where control flow can take more than one path.
Open Coverage Settings Dialog
Coverage settings are found under the Coverage pane of the Configuration Parameters dialog. To automatically navigate to this pane, from the Simulink Editor, select Analysis > Coverage > Settings.
Enable Multiple Coverage Metrics
To enable the coverage tool, select Enable coverage analysis. This setting enables the other options in the Coverage pane.
The Coverage metrics group controls the types of coverage information that is collected during simulation.
The Structural coverage level drop-down menu allows you to select which structural coverage metrics will be analyzed during simulation. These are ordered from the least rigorous (Block Execution) to the most rigorous (Modified Condition Decision (MCDC)).
For this example, select the Modified Condition Decision (MCDC) structural coverage level. The resulting report will also include decision and condition coverage results.
Additional coverage metrics can be found under the Other metrics toggle panel. Click the black arrow to expand this panel and see the available metrics. Selecting all coverage metrics provides the most coverage information.
For this example, select Signal Range and Lookup Table.
Click OK to apply your selected settings and close the Coverage Settings dialog box.
Run Simulation and Explore Results
Once you enable coverage collection for your model, coverage information is automatically recorded when you simulate the model. At the end of the simulation, the Coverage Results Explorer is opened, showing results for the latest coverage analysis.
Produce Coverage Report from Results Explorer
The Coverage Results Explorer offers various functionality for processing, displaying, and reporting coverage results from previous simulations of your model.
Click the Generate report link at the bottom of the Coverage Results Explorer window. This produces an HTML report of coverage information that displays within the built-in MATLAB® web browser.