| Simulink Verification and Validation | ![]() |
www.kxcad.net Home > CAE Software Index > MATLAB Index >
Display condition coverage information for model object
coverage = conditioninfo(cvdo, object)
coverage = conditioninfo(cvdo, object, ignore_descendants)
[coverage, description] = conditioninfo(cvdo, object)
coverage = conditioninfo(cvdo, object) returns condition coverage results from the cvdata object cvdo for the model component specified by object. See Specifying a Model Object for more information about the object argument. The value of coverage is a two-element vector of form [covered_outcomes total_outcomes], the elements of which are defined as follows:
covered_outcomes — the number of condition outcomes satisfied for object
total_outcomes — the total number of condition outcomes for object
Note coverage is empty if cvdo does not contain condition coverage results for object. |
coverage = conditioninfo(cvdo, object, ignore_descendants) returns condition coverage results for object, ignoring the coverage of its descendent objects if ignore_descendants is true (i.e., 1).
[coverage, description] = conditioninfo(cvdo, object) returns condition coverage results and textual descriptions of each condition in object. description is a structure array containing the following fields:
text — string describing a condition or the block port to which it applies
trueCnts — number of times the condition was true in a simulation
falseCnts — number of times the condition was false in a simulation
The object argument specifies an object in the Simulink model or Stateflow diagram that received decision coverage. Valid values for object include the following:
| Object Specification | Description |
|---|---|
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 block and the ID of an object contained in that chart |
{BlockPath, sfObj} | Cell array with the path to a Stateflow block and a Stateflow object API handle contained in that chart |
[BlockHandle, sfID] | Array with a Stateflow block handle and the ID of an object contained in that chart |
The following commands open the slvnvdemo_cv_small_controller demo model, create the test specification object testObj, enable condition coverage for testObj, and execute testObj.
mdl = 'slvnvdemo_cv_small_controller'; open_system(mdl) testObj = cvtest(mdl) testObj.settings.condition = 1; data = cvsim(testObj)
Afterward, issue the following commands to retrieve the condition coverage results for the Logic block (in the Gain subsystem) and determine its percentage of condition outcomes covered.
blk_handle = get_param([mdl, '/Gain/Logic'], 'Handle'); cov = conditioninfo(data, blk_handle) percent_cov = 100 * cov(1) / cov(2)
| Functions — Alphabetical List | cv.cvdatagroup | ![]() |
© 1984-2007 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments