Main Content

Collect Coverage for Code

Measure coverage for code in model elements or generated from models

Simulink® Coverage™ measures code coverage and indicates the untested elements of your design. You can collect coverage for the C/C++ code in supported model elements, MATLAB® Function blocks, or the code generated from models in software-in-the-loop (SIL) mode or processor-in-the-loop (PIL) mode. Simulink Coverage measures several types of code coverage analysis, such as statement, condition, decision, and modified condition/decision coverage.

Functions

slcovmexBuild coverage-compatible MEX-function from C/C++ code
cvtestCreate model coverage test specification object
cvsimSimulate and return model coverage results for test objects

Model Settings

expand all

Enable coverage analysisAnalyze coverage
Scope of coverage analysisSet scope of coverage analysis
Select ModelsSelect models to include in coverage analysis
Select SubsystemSelect subsystem to include in coverage analysis
Include in analysis: MATLAB filesEnable coverage for external MATLAB files
Include in analysis: C/C++ S-functionsAnalyze coverage for C/C++ S-Function blocks
Structural coverage levelTypes of coverage to analyze
Save last run in workspace variableSave results of most recent coverage analysis to MATLAB workspace
cvdata object nameName of workspace variable that contains coverage results
Increment variable name with each simulationCreate new coverage data variable for each simulation
Autosave data file nameFile name for coverage data file
Restrict coverage recording intervalAnalyze coverage during a specific time interval
Coverage interval start timeSimulation time to begin coverage analysis
Coverage interval stop timeSimulation time to stop coverage analysis

Topics

Code Coverage Basics

Coverage for MATLAB Code Used in Simulink

Coverage for Integrated C/C++ Code

Coverage for Generated Code