Retrieve decision coverage information from cvdata object
coverage = decisioninfo(cvdo, object)
coverage = decisioninfo(cvdo, object, ignore_descendants)
[coverage, description] = decisioninfo(cvdo, object)
The object argument specifies an object in the model or Stateflow® chart that received decision coverage. Valid values for object include the following:
Specifies to ignore the coverage of descendant objects if ignore_descendants is set to 1.
The value of coverage is a two-element vector of the form [covered_outcomes total_outcomes].coverage is empty if cvdo does not contain decision coverage results for object. The two elements are:
description is a structure array containing the following fields:
Open the slvnvdemo_cv_small_controller model and create the test specification object testObj. Enable decision coverage for slvnvdemo_cv_small_controller and execute testObj using cvsim. Use decisioninfo to retrieve the decision coverage results for the Saturation block and determine the percentage of decision outcomes covered:
mdl = 'slvnvdemo_cv_small_controller'; open_system(mdl) testObj = cvtest(mdl) testObj.settings.decision = 1; data = cvsim(testObj) blk_handle = get_param([mdl, '/Saturation'], 'Handle'); cov = decisioninfo(data, blk_handle) percent_cov = 100 * cov(1) / cov(2)
Use the Coverage Settings dialog box to collect and display decision coverage results:
Open the model.
In the Model Editor, select Analysis > Coverage > Settings.
On the Coverage tab, select Coverage for this model.
Under Coverage metrics, select Decision.
On the Results and Reporting tabs, specify the output you need.
Click OK to close the Coverage Settings dialog box and save your changes.
Simulate the model and review the results.