removeRule
类: slcoverage.Filter
命名空间: slcoverage
从过滤器规则集中删除规则
语法
result = removeRule(filter,rule)
输入参数
filter
— 要从中删除规则的过滤对象
slcoverage.Filter
对象
要从中删除规则的过滤对象,指定为 slcoverage.Filter
对象。
rule
— 从过滤器中删除的规则
slcoverage.FilterRule
对象
从过滤器中删除的规则,指定为 slcoverage.FilterRule
对象。
输出参量
result
— 规则移除结果
逻辑值
规则删除结果,返回 0 或 1。
示例
从过滤对象中删除规则
此示例显示如何以编程方式从覆盖率过滤器中删除规则。
打开模型并指定覆盖率设置。
modelName = 'slcoverage_lct_bus'; open_system(modelName); set_param(modelName,'CovMetricStructuralLevel','MCDC',... 'RecordCoverage','on');
创建两个 BlockSelector
对象,blockSel1
和 blockSel2
。
blockSel1 = slcoverage.BlockSelector(... slcoverage.BlockSelectorType.BlockType,'RelationalOperator'); blockSel2 = slcoverage.BlockSelector(... slcoverage.BlockSelectorType.BlockInstance,... 'slcoverage_lct_bus/slCounter/And');
创建一个过滤器对象,创建两个规则对象,并将每个规则添加到过滤器对象。
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);
审查规则。查找数组中的第一个规则。
filtRules = filt.rules filtRules(1)
filtRules = 1x2 FilterRule array with properties: Selector Mode Rationale ans = FilterRule with properties: Selector: [1x1 slcoverage.BlockSelector] Mode: Exclude Rationale: 'Tested elsewhere'
删除您添加的第一条规则。然后检查规则,发现您添加的第一条规则已被删除。
filt.removeRule(rule1); filtRules = filt.rules
filtRules = FilterRule with properties: Selector: [1x1 slcoverage.BlockSelector] Mode: Justify Rationale: 'Value is never greater than 0'
版本历史记录
在 R2017b 中推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
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)