removeRule
Class: slcoverage.Filter
Namespace: slcoverage
Remove rule from filter rule set
Syntax
result = removeRule(filter,rule)
Input Arguments
Filter object to remove the rule from, specified as an
slcoverage.Filter object.
Rule to remove from the filter, specified as an
slcoverage.FilterRule object.
Output Arguments
Rule removal result, returned as 0 or 1.
Examples
This example shows how to remove a rule from a coverage filter programmatically.
Open the model and specify coverage settings.
modelName = 'slcoverage_lct_bus'; open_system(modelName); set_param(modelName,'CovMetricStructuralLevel','MCDC',... 'RecordCoverage','on');

Create two BlockSelector objects, blockSel1 and blockSel2.
blockSel1 = slcoverage.BlockSelector(... slcoverage.BlockSelectorType.BlockType,'RelationalOperator'); blockSel2 = slcoverage.BlockSelector(... slcoverage.BlockSelectorType.BlockInstance,... 'slcoverage_lct_bus/slCounter/And');
Create a filter object, create two rule objects, and add each rule to the filter object.
filt = slcoverage.Filter; rule1 = slcoverage.FilterRule(blockSel1,'Tested elsewhere',... slcoverage.FilterMode.Exclude); rule2 = slcoverage.FilterRule(blockSel2,'Value is never greater than 0'); filt.addRule(rule1); filt.addRule(rule2);
Review the rules. Look the first rule in the array.
filtRules = filt.rules filtRules(1)
filtRules =
1×2 FilterRule array with properties:
Selector
Mode
Rationale
ans =
FilterRule with properties:
Selector: [1×1 slcoverage.BlockSelector]
Mode: Exclude
Rationale: 'Tested elsewhere'
Remove the first rule that you added. Then review the rules to see that the first rule that you added is removed.
filt.removeRule(rule1); filtRules = filt.rules
filtRules =
FilterRule with properties:
Selector: [1×1 slcoverage.BlockSelector]
Mode: Justify
Rationale: 'Value is never greater than 0'
Version History
Introduced in R2017b
See Also
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)