Main Content


Create HTML coverage report from model coverage objects


cvhtml(file,cvdo) creates an HTML report of the coverage results in the cvdata or cv.cvdatagroup object cvdo with the file name file. The model must be open when you call cvhtml.

cvhtml(file,cvdo1,...,cvdoN) creates a combined report from several cvdata objects. The results from each object appear in a separate column of the HTML report. Each cvdata object must correspond to the same root model or subsystem.

cvhtml(file,cvdo1,...,cvdoN,options) creates a combined report from several cvdata objects using the report options specified by options.

cvhtml(file,cvdo,simMode) creates an HTML report for the models that have the simulation mode simMode.


collapse all

Set your current folder to a writeable directory.

Open your model and collect coverage by using cvsim.

modelName = 'slvnvdemo_cv_small_controller'; 
cvd = cvsim(modelName); 

Create a coverage report for the model and save the report as ratelim_coverage.html.

outfile = 'ratelim_coverage.html';

Input Arguments

collapse all

Coverage data, specified as a cvdata object or cv.cvdatagroup object.

Data Types: cvdata | cv.cvdatagroup

File name of the generated report, specified as a character array or string array. Specify the absolute path or relative path and the file name.

Report options, specified as a character vector or string that consists of an option from the table, an equal sign, and 0 or 1.

  • To enable an option, use 1.

Example: "-hTR=1"

  • To disable an option, use 0.

Example: "-sRT=0"

  • To specify multiple report options, list the options in a single character vector or string separated by commas or spaces.

Example: "-hTR=1 -bRG=0 -scm=0"



Show report



Web view mode



Include each test in the model summary



Show aggregated tests information in coverage report



Produce bar graphs in the model summary



Use two-color bar graphs



Display hit/count ratio in the model summary



Exclude execution metric details from report



Exclude fully covered model objects from report



Exclude fully covered model object details from report



Include cyclomatic complexity numbers in summary



Include cyclomatic complexity numbers in block details



Filter Stateflow® events from report



Include linked requirements in coverage report


Data Types: char | string

Simulation mode, specified as one of these values:

Object SpecificationDescription


Model in Normal simulation mode

"SIL" (or "PIL")

Model in software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation mode

"ModelRefSIL" (or "ModelRefPIL")

Model reference in SIL or PIL simulation mode

"ModelRefTopSIL" (or "ModelRefTopPIL")

Model reference in SIL or PIL simulation mode with code interface set to top model


Use the Simulink® Editor to generate a coverage report when you simulate the model:

  1. Open the model for which you want a model coverage report.

  2. In the Simulink Editor, in the Modeling tab, select Model Settings.

  3. In the Coverage pane of the Configuration Parameters dialog box, select Enable coverage analysis.

  4. Click OK.

  5. Click Run (Coverage) to simulate the model. When the simulation completes, the coverage report opens in the Coverage Details pane.

Version History

Introduced before R2006a

expand all