Main Content

slcoverage.FilterRule Class

Namespace: slcoverage

Create coverage filter rule

Description

Use an object of the slcoverage.FilterRule class to specify a coverage filtering rule that includes the selector and the rationale for filtering.

The slcoverage.FilterRule class is a handle class.

Creation

rule = slcoverage.FilterRule(selector,rationale) creates the filter rule object rule using the specified selector and rationale and sets the selector and rationale properties.

rule = slcoverage.FilterRule(selector,rationale,mode) creates a FilterRule object with the specified filter mode and sets the mode property. You can use only justify with metric selectors.

Properties

expand all

Selector for the rule, specified as an slcoverage.BlockSelector object, slcoverage.MetricSelector object, slcoverage.SFcnSelector object, or slcoverage.CodeSelector object. The selector specifies the model object or coverage outcome to which the rule applies.

Attributes:

GetAccess
public
SetAccess
public

Data Types: slcoverage.BlockSelector | slcoverage.MetricSelector | slcoverage.SFcnSelector | slcoverage.CodeSelector

Rationale for filter rule, specified as a character array or string array.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Filter mode, specified as slcoverage.FilterMode.Justify or slcoverage.FilterMode.Exclude.

Attributes:

GetAccess
public
SetAccess
public

Data Types: slcoverage.FilterMode

Examples

collapse all

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

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

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

Select blocks with block type 'RelationalOperator' to add a filter rule for.

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

Create a filter object, create a rule, and add the rule to the filter. This rule excludes the selection from coverage analysis.

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

Version History

Introduced in R2017b