rules
类: slcoverage.Filter
命名空间: slcoverage
过滤器规则
语法
fr = rules(filter)
fr = rules(filter,element)
输入参数
filter
— 要返回其规则的过滤对象
slcoverage.Filter
对象
要返回其规则的过滤对象,指定为 slcoverage.Filter
对象。
element
— 元素标识符
Simulink® ID | 属性 | 句柄
此 属性 为只读。
要返回其规则的模型元素的标识符,指定为 Simulink ID、模型元素属性或句柄的字符向量或字符串。
输出参量
fr
— 过滤器规则
slcoverage.FilterRule
对象 | slcoverage.FilterRule
对象数组
过滤规则,以 slcoverage.FilterRule
对象或 slcoverage.FilterRule
对象数组返回。
示例
获取过滤器对象的所有规则
打开一个模型。指定覆盖率设置并打开覆盖率记录。
modelName = 'slcoverage_lct_bus'; open_system(modelName); set_param(modelName,'CovMetricStructuralLevel','MCDC','RecordCoverage','on');
创建一个 BlockSelector
对象,bl
。创建一个过滤器对象,创建一个规则,并将规则添加到过滤器中。
bl = slcoverage.BlockSelector(slcoverage.BlockSelectorType.BlockType,'RelationalOperator'); filt = slcoverage.Filter; rule = slcoverage.FilterRule(bl,'Tested elsewhere',slcoverage.FilterMode.Exclude); filt.addRule(rule);
创建另一条规则并将其添加到过滤器对象。
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
返回过滤规则。查看数组中的第一条规则。
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
仅返回 And 模块的规则。
filt.rules(id)
ans = FilterRule with properties: Selector: [1×1 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)