Contents

Basic Operation of the Model Coverage Tool

This example shows how to use the dialog box for coverage settings to enable coverage for a Simulink® model and adjust the type of information that is reported.

Open Example Model

The sldemo_clutch example model 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 sldemo_clutchOpen sldemo_clutch

Open Coverage Settings Dialog Box

To open the Coverage Settings dialog box, from the Simulink Editor, select Analysis > Coverage > Settings.

Open Coverage Settings dialog boxOpen Coverage Settings dialog box

Enable Multiple Coverage Metrics

To enable coverage reporting, select Coverage for this model. This setting enables the other options in the Coverage Settings dialog box.

Enable coverage reportingEnable coverage reporting

The Coverage metrics group controls the types of coverage information that is collected during simulation. Selecting all coverage metrics provides the most coverage information. For this example, select Decision, Condition, MCDC, Signal Range, and Lookup Table.

Select these coverage metricsSelect these coverage metrics

Click OK to apply your selected settings and close the Coverage Settings dialog box.

Apply settings and close the dialogApply settings and close the dialog

Run Simulation and Produce Coverage Report

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 model coverage tool produces an HTML report of coverage information that displays within the built-in MATLAB® web browser.

Run simulation and produce coverage reportRun simulation and produce coverage report

Close Example Model

Close sldemo_clutchClose sldemo_clutch

Was this topic helpful?