Rules for filter
fr = rules(filter)
fr = rules(filter,element)
filter— Filter object whose rules to return
Filter object whose rules to return, specified as an
element— Element identifier
This property is read-only.
Identifier of the model element whose rules to return, specified as a character vector or string of the Simulink ID, model element property, or handle.
fr— Filter rules
slcoverage.FilterRuleobject | array of
Filter rules, returned as an
object or an array of
Open a model. Specify coverage settings and turn on coverage recording.
modelName = 'slcoverage_lct_bus'; open_system(modelName); set_param(modelName,'CovMetricStructuralLevel','MCDC','RecordCoverage','on');
Create a filter object, create a rule, and add the rule to the
bl = slcoverage.BlockSelector(slcoverage.BlockSelectorType.BlockType,'RelationalOperator'); filt = slcoverage.Filter; rule = slcoverage.FilterRule(bl,'Tested elsewhere',slcoverage.FilterMode.Exclude); filt.addRule(rule);
Create another rule and add it to the filter object.
id = Simulink.ID.getSID('slcoverage_lct_bus/slCounter/And'); bl = slcoverage.BlockSelector(slcoverage.BlockSelectorType.BlockInstance,id); rule = slcoverage.FilterRule(bl,'Value is never greater than 0'); filt.addRule(rule);
rules to return the filter rules. View first rule
in the array.
fi = filt.rules fi(1)
fi = 1×2 FilterRule array with properties: Selector Mode Rationale ans = FilterRule with properties: Selector: [1×1 slcoverage.BlockSelector] Mode: Exclude Rationale: 'Tested elsewhere'
rules to return the rule only for the
ans = FilterRule with properties: Selector: [1×1 slcoverage.BlockSelector] Mode: Justify Rationale: 'Value is never greater than 0'