Documentation Center

  • Trials
  • Product Updates

decisioninfo

Retrieve decision coverage information from cvdata object

Syntax

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

Description

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

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

[coverage, description] = decisioninfo(cvdo, object) returns decision coverage results and text descriptions of decision points associated with object.

Input Arguments

cvdo

cvdata object

object

The object argument specifies an object in the model or Stateflow® chart that received decision coverage. Valid values for object include the following:

Object SpecificationDescription

BlockPath

Full path to a model or block

BlockHandle

Handle to a model or block

slObj

Handle to a Simulink® API object

sfID

Stateflow ID

sfObj

Handle to a Stateflow API object from a singly instantiated Stateflow chart

{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 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

ignore_descendants

Specifies to ignore the coverage of descendant objects if ignore_descendants is set to 1.

Output Arguments

coverage

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:

covered_outcomesNumber of decision outcomes satisfied for object
total_outcomesNumber of decision outcomes for object

description

description is a structure array containing the following fields:

decision.textString describing a decision point, e.g., 'U > LL'
decision.outcome.textString describing a decision outcome, i.e., 'true' or 'false'
decision.outcome.
executionCount
Number of times a decision outcome occurred in a simulation

Examples

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)

Alternatives

Use the Coverage Settings dialog box to collect and display decision coverage results:

  1. Open the model.

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

  3. On the Coverage tab, select Coverage for this model.

  4. Under Coverage metrics, select Decision.

  5. On the Results and Reporting tabs, specify the output you need.

  6. Click OK to close the Coverage Settings dialog box and save your changes.

  7. Simulate the model and review the results.

See Also

| | | | | | | |

Was this topic helpful?