Retrieve cyclomatic complexity coverage information from
complexity = complexityinfo(cvdo, object)
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 dialog box to collect and display cyclomatic complexity coverage results in the coverage report:
Open the model.
In the Model Editor, select Analysis > Coverage > Settings.
On the Coverage tab, select Coverage for this model.
Under Coverage metrics, select:
On the Reporting tab, click HTML Settings.
In the HTML Settings dialog box, select:
Include cyclomatic complexity numbers in summary
Include cyclomatic complexity numbers in block details
Click OK to close the HTML Settings dialog box and save your changes.
Click OK to close the Coverage Settings dialog box and save your changes.
Simulate the model and review the results in the HTML report.