Main Content

addRule

Class: slcoverage.Filter
Namespace: slcoverage

Add coverage filtering rule to filter

Syntax

result = addRule(filter,rule)

Description

result = addRule(filter,rule) adds the filter rule to the specified filter.

Input Arguments

expand all

Filter object to add the rule to, specified as an slcoverage.Filter object.

Rule to add to the filter, specified as an slcoverage.FilterRule object.

Output Arguments

expand all

Rule addition result, returned as 0 or 1.

Examples

expand all

Create a block selector, a filter, and a rule for the selector. Then add the rule to the filter.

Open the model. Specify coverage settings and turn on coverage recording.

modelName = 'slcoverage_lct_bus';
openExample(modelName);
open_system(modelName);
set_param(modelName,'CovMetricStructuralLevel','MCDC','RecordCoverage','on');

Create a BlockSelector object, bl. This block selector selects all blocks in the model with the property 'RelationalOperator'.

bl = slcoverage.BlockSelector(slcoverage.BlockSelectorType.BlockType,'RelationalOperator');

Create a filter object, create a rule object, and add the rule to the filter object.

filt = slcoverage.Filter;
rule = slcoverage.FilterRule(bl,'Tested elsewhere',slcoverage.FilterMode.Exclude);
filt.addRule(rule);

Version History

Introduced in R2017b