decisioninfo
Retrieve decision coverage information from cvdata
object
Syntax
Description
returns decision coverage results from the covInfo
= decisioninfo(cvdo
, modelObject
)cvdata
object
cvdo
for the model component specified by
modelObject
.
returns decision coverage results from the covInfo
= decisioninfo(cvdo
, modelObject
, simMode
)cvdata
object
cvdo
for the model component specified by
modelObject
for the simulation mode
simMode
.
returns decision coverage results for covInfo
= decisioninfo(cvdo
, modelObject
, ignoreDescendants
)modelObject
, depending on
the value of ignoreDescendants
.
[
returns decision coverage results and text descriptions of decision points
associated with covInfo
, description
]
= decisioninfo(cvdo
, modelObject
)modelObject
.
Examples
View Decision Coverage Data
This example shows how to view decision coverage data for a block in your model.
Load the model.
modelName = 'slvnvdemo_cv_small_controller';
load_system(modelName);
Configure the coverage settings for the model by using a Simulink.SimulationInput
object.
simIn = Simulink.SimulationInput(modelName); simIn = setModelParameter(simIn,'CovEnable','on'); simIn = setModelParameter(simIn,'CovMetricStructuralLevel','Decision'); simIn = setModelParameter(simIn,'CovSaveSingleToWorkspaceVar','on'); simIn = setModelParameter(simIn,'CovSaveName','covData');
Simulate the model by passing simIn
as the input to sim
.
simOut = sim(simIn);
Extract the coverage data as a cvdata
object from the SimulationOutput
object, simOut
.
covData = simOut.covData;
View the decision coverage results for the Saturation block by calling decisioninfo
with the block path.
blockPath = [modelName,'/Saturation'];
decisionCov = decisioninfo(covData,blockPath)
decisionCov = 3 4
decisioninfo
returns an array with two scalars. The first value is the number of satisfied decision outcomes, and the second value is the number of total decision outcomes. Use these to determine the percentage of satisfied decision outcomes for the Saturation block.
percentDecisionCov = 100 * decisionCov(1) / decisionCov(2)
percentDecisionCov = 75
Input Arguments
cvdo
— Coverage data
cvdata
object
Coverage data, specified as a cvdata
object.
Data Types: cvdata
modelObject
— Model object
character array
| string array
| Simulink® handle
| Stateflow® ID
| cell array
Model object, specified as a character array, string array, Simulink handle, Stateflow ID, or cell array.
To specify a model object, such as a block or a Stateflow chart, use one of these formats:
Object Specification | Description |
---|---|
| Full path to a model or block |
| Handle to a model or block |
| Handle to a Simulink API object |
| Stateflow ID |
| Handle to a Stateflow API object from a singly instantiated Stateflow chart |
| Cell array with the path to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart |
| Cell array with the path to a Stateflow chart or subchart and a Stateflow object API handle contained in that chart or subchart |
| Cell array with a handle to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart |
To specify an S-Function block or its contents, use one of these formats:
Object Specification | Description |
---|---|
| Cell array with the path to an S-Function block and the name of a source file |
| Cell array with an S-Function block handle and the name of a source file |
| Cell array with the path to an S-Function block, the name of a source file, and a function name |
| Cell array with an S-Function block handle, the name of a source file, and a function name |
To specify a code coverage result, such as coverage data collected during software-in-the-loop (SIL) or processor-in-the-loop (PIL) analysis, use one of these formats:
Object Specification | Description |
---|---|
| Cell array with the name of a source file and a function name |
| Cell array with a model name or model handle and the name of a source file |
| Cell array with a model name or model handle, the name of a source file, and a function name |
Data Types: char
| string
| cell
| Stateflow.State
| Stateflow.Transition
simMode
— Simulation mode
character array
| string array
Simulation mode during coverage analysis, specified as one of these options:
Object Specification | Description |
---|---|
| Model in normal simulation mode. |
| Model in software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation mode. |
| Model reference in SIL or PIL simulation mode. |
| Model reference in SIL or PIL simulation mode with the code interface set to top model. |
Data Types: char
| string
ignoreDescendants
— Whether to ignore descendants in coverage results
false
or 0
(default) | true
or 1
Whether to ignore descendants in coverage results, specified as a numeric or logical
1 (true)
or 0 (false)
, where:
0 (false)
includes coverage results of descendant objects.1 (true)
ignores coverage results of descendant objects.
Data Types: single
| double
| logical
Output Arguments
covInfo
— Coverage information
scalar
Coverage information, returned as a two-element array of the form
[covered_outcomes,total_outcomes]
if
cvdo
contains decision coverage data, or an empty
array if it does not.
covered_outcomes | Number of decision outcomes satisfied for
modelObject |
total_outcomes | Total number of decision outcomes for
modelObject |
Data Types: double
description
— Decision coverage description
structure
Decision coverage description, returned as a structure array with the following fields:
isFiltered
— Block exclusion flag
0
| 1
Block exclusion flag, returned as 1
if the
block is excluded and 0
if it is not.
Data Types: double
filterRationale
— Block coverage filter rationale
character array
Block coverage filter rationale, returned as a character array.
Data Types: char
justifiedCoverage
— Number of justified coverage objective outcomes
scalar
Number of justified coverage objective outcomes, returned as a scalar double.
Data Types: double
isJustified
— Block justification flag
0
| 1
Block justification flag, returned as 1
if
the block is justified or 0
if it is
not.
Data Types: double
decision
— Information for individual decisions
structure array
Information for individual decisions, returned as a structure with the following fields:
isFiltered
— Decision exclusion flag
0
| 1
Decision exclusion flag, returned as
1
if the decision is excluded
or 0
if it is not.
Data Types: double
isJustified
— Decision justification flag
0
| 1
Decision justification flag, returned as
1
if the decision is justified
or 0
if it is not.
Data Types: double
filterRationale
— Coverage filter rationale
character array
Coverage filter rationale, returned as a character array.
Data Types: char
text
— Description of decision
character array
Description of the decision, returned as a character array.
Data Types: char
outcome
— Information for individual decision outcomes
structure
Information for individual decision outcomes, returned as a structure array with the following fields:
text | Outcome of the decision, returned as
'true' or
'false' . |
executionCount | The number of time steps the decision had this outcome, returned as a scalar double. |
isFiltered | Decision outcome exclusion flag, returned
as 1 if the outcome is excluded
or 0 if it is not. |
isJustified | Decision outcome justification flag,
returned as 1 if the outcome is
justified or 0 if it is
not. |
filterRationale | Coverage filter rationale, returned as a character array. |
executedIn | Aggregated coverage test case traceability
information, returned as a structure array. If
your coverage data does not contain aggregated
results from multiple simulations,
executedIn is an empty array.
If your coverage data contains aggregated results,
executedIn indicates which test
runs executed the decision outcome. |
executedIn.uniqueId | Unique identifier for the
cvdata object created by the test
case that executed this condition outcome,
returned as a character array. |
executedIn.analyzedModel | The name of the model analyzed, returned as a character array. |
executedIn.description | The test case description, returned as a character array. |
executedIn.date | The date and time of the simulation that
created the cvdata object,
returned as a character array. |
executedIn.traceLabel | The short name of the test case, returned as a character array. |
executedIn.testRunInfo | Test details, returned as a structure array. |
executedIn.testRunInfo.runid | The identifier of the run that generated the coverage result, returned as a scalar double. |
executedIn.testRunInfo.runName | The name of the test case that generated the coverage result, returned as a character array. |
executedIn.testRunInfo.testId | Identifying data for the test case that generated the coverage result, returned as a structure array. |
executedIn.testRunInfo.testId.uuid | The unique identifier for the test case that generated the coverage result, returned as a character array. |
executedIn.testRunInfo.testId.contextType | The test context in which the coverage result was obtained, returned as one of these values:
|
Data Types: struct
Data Types: struct
Data Types: struct
Alternatives
Use the coverage settings to collect and display decision coverage results:
Open the model.
In the Model Editor, select Model Settings on the Modeling tab.
On the Coverage pane of the Configuration Parameters dialog box, select Enable coverage analysis.
Under Coverage metrics, select Decision as the structural coverage level.
Click OK to close the Configuration Parameters dialog box and save your changes.
Simulate the model by clicking the Run button and review the results.
Version History
Introduced in R2006b
See Also
complexityinfo
| conditioninfo
| cvsim
| getCoverageInfo
| mcdcinfo
| overflowsaturationinfo
| sigrangeinfo
| sigsizeinfo
| tableinfo
| executioninfo
| relationalboundaryinfo
Topics
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)