|
|
|
| R2012a Documentation → Simulink Verification and Validation | |
Learn more about Simulink Verification and Validation |
|
| Contents | Index |
complexity = complexityinfo(cvdo, object)
complexity = complexityinfo(cvdo, object) returns complexity coverage results from the cvdata object cvdo for the model component object.
complexity |
If cvdo does not contain cyclomatic complexity coverage results for object, complexity is empty. If cvdo contains cyclomatic complexity coverage results for object, complexity is a two-element vector of the form [total_complexity local_complexity]:
If object has variable-size signals, complexity also contains the variable complexity. |
Open the sldemo_fuelsys model and create the test specification object testObj. Enable decision, condition, and MCDC coverage for sldemo_fuelsys and execute testObj using cvsim. Use complexityinfo to retrieve cyclomatic complexity results for the Throttle subsystem. The Throttle subsystem itself does not record cyclomatic complexity coverage results, but the contents of the subsystem do record cyclomatic complexity coverage.
mdl = 'sldemo_fuelsys';
open_system(mdl);
testObj = cvtest(mdl)
testObj.settings.decision = 1;
testObj.settings.condition = 1;
testObj.settings.mcdc = 1;
data = cvsim(testObj);
blk_handle = get_param([mdl, ...
'/Engine Gas Dynamics/Throttle & Manifold/Throttle'],...
'Handle');
coverage = complexityinfo(data, blk_handle);
coverageTo collect and display cyclomatic complexity coverage results in the coverage report:
Open the model.
In the Model Editor, select Tools > Coverage Settings.
On the Coverage tab, under Coverage Metrics, select:
Decision
Condition
MCDC
On the Reporting tab, click HTML Settings.
On the HTML Settings dialog box, select:
Include cyclomatic complexity numbers in summary
Include cyclomatic complexity numbers in block details
Click OK to close the HTML Settings dialog box and save your changes.
Click OK to close the Coverage Settings dialog box and save your changes.
Simulate the model and review the results in the HTML report.
conditioninfo | cvsim | decisioninfo | getCoverageInfo | mcdcinfo | sigrangeinfo | sigsizeinfo | tableinfo

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 |