Skip to Main Content Skip to Search
Product Documentation

conditioninfo - Collect condition coverage information for model object

Syntax

coverage = conditioninfo(cvdo, object)
coverage = conditioninfo(cvdo, object, ignore_descendants)
[coverage, description] = conditioninfo(cvdo, object)

Description

coverage = conditioninfo(cvdo, object) returns condition coverage results from the cvdata object cvdo for the model component specified by object.

coverage = conditioninfo(cvdo, object, ignore_descendants) returns condition coverage results for object, depending on the value of ignore_descendants.

[coverage, description] = conditioninfo(cvdo, object) returns condition coverage results and textual descriptions of each condition in object.

Input Arguments

cvdo

cvdata object

ignore_descendants

Logical value that specifies whether to ignore the coverage of descendant objects

1 to ignore coverage of descendant objects
0 (default) to collect coverage of descendant objects

object

An object in the Simulink model or Stateflow diagram that receives decision coverage. Valid values for object are as follows:

BlockPath

Full path to a Simulink model or block

BlockHandle

Handle to a Simulink model or block

slObj

Handle to a Simulink API object

sfID

Stateflow ID

sfObj

Handle to a Stateflow API object

{BlockPath, sfID}

Cell array with the path to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart

{BlockPath, sfObj}

Cell array with the path to a Stateflow chart or atomic subchart and a Stateflow object API handle contained in that chart or subchart

[BlockHandle, sfID]

Array with a handle to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart

Output Arguments

coverage

The value of coverage is a two-element vector of form [covered_outcomes total_outcomes]. coverage is empty if cvdo does not contain condition coverage results for object. The two elements are:

covered_outcomesNumber of condition outcomes satisfied for object
total_outcomesTotal number of condition outcomes for object

description

A structure array with the following fields:

textString describing a condition or the block port to which it applies
trueCntsNumber of times the condition was true in a simulation
falseCntsNumber of times the condition was false in a simulation

Examples

The following example opens the slvnvdemo_cv_small_controller demo model, creates the test specification object testObj, enables condition coverage for testObj, and executes testObj. Then retrieve the condition coverage results for the Logic block (in the Gain subsystem) and determine its percentage of condition outcomes covered:

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)

Alternatives

To collect condition coverage for a model using the GUI:

  1. Open the model for which you want condition coverage.

  2. In the Model Editor, select Tools > Coverage Settings.

  3. On the Coverage tab, under Coverage Metrics, select Condition Coverage.

  4. View the Results and Report tab to specify the type of output you need.

  5. Click OK.

  6. Simulate the model.

See Also

complexityinfo | cvsim | decisioninfo | getCoverageInfo | mcdcinfo | sigrangeinfo | sigsizeinfo | tableinfo

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS