Retrieve cyclomatic complexity coverage information from
complexity = complexityinfo(cvdo, object)
complexity = complexityinfo(cvdo, object, mode)
When specifying an S-function block, valid values for
For coverage data collected during Software-in-the-Loop (SIL)
mode or Processor-in-the-Loop (PIL) simulation mode, valid values
sldemo_fuelsys model and create
the test specification object
testObj. Enable decision,
condition, and MCDC coverage for
complexityinfo to retrieve cyclomatic complexity
results for the Throttle subsystem. The Throttle subsystem itself
does not record cyclomatic complexity coverage results, but the contents
of the subsystem do record cyclomatic complexity coverage.
mdl = 'sldemo_fuelsys'; open_system(mdl); testObj = cvtest(mdl) testObj.settings.decision = 1; testObj.settings.condition = 1; testObj.settings.mcdc = 1; data = cvsim(testObj); blk_handle = get_param([mdl, ... '/Engine Gas Dynamics/Throttle & Manifold/Throttle'],... 'Handle'); coverage = complexityinfo(data, blk_handle); coverage
Use the coverage settings to collect and display cyclomatic complexity coverage results in the coverage report:
Open the model.
In the Simulink Editor, select Model Settings on the Modeling tab.
On the Coverage pane of the Configuration Parameters dialog box, select Enable coverage analysis.
Under Coverage metrics, select MCDC as the structural coverage level.
Click OK to close the Configuration Parameters dialog box and save your changes.
Simulate the model and review the results in the HTML report.