Add coverage filtering rule to filter
result = addRule(filter,rule)
filter— Filter object to add the rule to
Filter object to add the rule to, specified as an
rule— Rule to add to the filter
Rule to add to the filter, specified as an
result— Rule addition result
Rule addition result, returned as 0 or 1.
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 = 'sldemo_lct_bus'; open_system(modelName); set_param(modelName,'CovMetricStructuralLevel','MCDC','RecordCoverage','on');
This block selector selects all blocks in
the model with the property
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);