Retrieve condition coverage information from
coverage = conditioninfo(cvdo, object)
coverage = conditioninfo(cvdo, object, ignore_descendants)
[coverage, description] = conditioninfo(cvdo, object)
An object in the Simulink® model or Stateflow® diagram
that receives decision coverage. Valid values for
Logical value that specifies whether to ignore the coverage of descendant objects
The value of
A structure array with the following fields:
The following example opens the
model, creates the test specification object
enables condition coverage for
testObj, and executes
Then retrieve the condition coverage results for the Logic block (in
the Gain subsystem) and determine its percentage of condition outcomes
mdl = 'slvnvdemo_cv_small_controller'; open_system(mdl) testObj = cvtest(mdl) testObj.settings.condition = 1; data = cvsim(testObj) blk_handle = get_param([mdl, '/Gain/Logic'], 'Handle'); cov = conditioninfo(data, blk_handle) percent_cov = 100 * cov(1) / cov(2)
Use the Coverage Settings dialog box to collect condition coverage for a model:
Open the model for which you want to collect condition coverage.
In the Model Editor, select Analysis > Coverage > Settings.
On the Coverage tab, select Coverage for this model.
Under Coverage metrics, select Condition.
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.