rules
Class: slcoverage.Filter
Namespace: slcoverage
Rules for filter
Syntax
fr = rules(filter)
fr = rules(filter,element)
Description
returns all the rules assigned to the filter.fr
= rules(filter
)
returns only the rules for the specified model element.fr
= rules(filter
,element
)
Input Arguments
filter
— Filter object whose rules to return
slcoverage.Filter
object
Filter object whose rules to return, specified as an
slcoverage.Filter
object.
element
— Element identifier
Simulink® ID | property | handle
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.
Output Arguments
fr
— Filter rules
slcoverage.FilterRule
object | array of slcoverage.FilterRule
objects
Filter rules, returned as an slcoverage.FilterRule
object or an array of slcoverage.FilterRule
objects.
Examples
Get All Rules for Filter Object
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 BlockSelector
object, bl
.
Create a filter object, create a rule, and add the rule to the
filter.
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);
Use 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'
Use rules
to return the rule only for the
And block.
filt.rules(id)
ans = FilterRule with properties: Selector: [1×1 slcoverage.BlockSelector] Mode: Justify Rationale: 'Value is never greater than 0'
Version History
Introduced in R2017b
See Also
slcoverage.Filter
| addRule
| slcoverage.FilterRule
| removeRule
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)