slmetric.metric.Result
(待删除)指定模型组件和度量算法的度量数据
以后的版本中将会删除度量仪表板用户界面、metricdashboard 函数、slmetric 包 API 以及相应的自定义项。有关详细信息,请参阅从度量盘迁移到模型可维护性仪表盘。
说明
slmetric.metric.Result 对象包含指定模型组件和度量算法的度量数据。
创建对象
描述
创建一个度量结果对象的句柄。metric_result = slmetric.metric.Result
或者,如果您将结果收集到 slmetric.metric.ResultCollection 对象中,则集合对象的 Results 属性将以数组返回收集到的 slmetric.metric.Result 对象。
属性
此 属性 为只读。
度量结果对象的唯一数字标识符,以整数形式返回。
数据类型: uint64
计算度量所针对的组件对象的唯一标识符,以字符向量的形式指定。使用 ComponentID 将生成的结果对象追踪到被分析的组件。使用 algorithm 方法设置 ComponentID 或 ComponentPath 属性。
示例: 'sldemo_mdlref_basic'
数据类型: char
要计算度量的组件路径,以字符向量的形式指定。使用 ComponentPath 代替设置 ComponentID 属性。度量引擎将 ComponentPath 转换为 ComponentID。使用 algorithm 方法设置 ComponentID 或 ComponentPath 属性。
示例: 'vdp/More Info/Model Info/EmptySubsystem'
数据类型: char
模型度量度量标识符或您创建的自定义模型度量,以字符向量的形式指定。您可以通过调用 slmetric.metric.getAvailableMetrics 获得度量标识符。
示例: 'mathworks.metrics.SimulinkBlockCount'
数据类型: char
由算法生成的度量度量量值,该值由 MetricID 指定,由 ComponentID 指定,表示为双精度浮点数。
如果算法没有指定度量标量值,则 Value 的值为 NaN。例如,假设您收集包含 Stateflow 图的模型的度量数据。对于 StateflowChartObjectCount 度量,模型 slmetric.metric.Result 对象的 Value 属性为 NaN,因为模型本身不能有 Stateflow 对象。模型 slmetric.metric.Result 对象的 AggregatedValue 属性包含图中 Stateflow 对象的总数。
数据类型: double
此 属性 为只读。
度量值按模型层次结构聚合,以 double 类型返回。度量引擎会根据 AggregationMode 隐式地聚合度量值。如果所有组件的 Value 属性均为 NaN,则 AggregatedValue 为零。
数据类型: double
度量指标,由度量算法指定,以双数组形式指定。度量度量包含有关度量值的详细信息。例如,对于计算每个子系统块数的度量,您可以指定包含虚拟块和非虚拟块数量的度量。度量值是虚拟块数和非虚拟模块数的总和。
使用 slmetric.metric.Metric.algorithm 方法设置此属性。
数据类型: double
此 属性 为只读。
度量衡量模型层次结构中聚合的值,以双精度数组的形式返回。度量引擎会根据 AggregationMode 隐式地聚合度量度量值。
数据类型: double
有关度量引擎对 Value 属性(指定为 slmetric.metric.ResultDetail 对象数组)进行计数的详细信息。
此 属性 为只读。
度量数据类别,返回以下四个类别之一:
Compliant - 在可接受范围内的度量数据。
Warning - 需要审核的度量数据。
Noncompliant - 需要您修改模型的度量数据。
未分类 - 未设置阈值的度量数据。
度量数据类别以及与每个类别对应的范围,以 slmetric.config.ResultClassification 对象的形式指定。如果没有设置阈值,则此属性为空。
用户数据(由度量算法可选提供),以字符向量的形式指定。
数据类型: char
示例
本示例展示了如何收集和访问模型 sldemo_mdlref_basic 的度量数据。
打开 sldemo_mdlref_basic 模型。
open_system('sldemo_mdlref_basic');
创建一个 slmetric.Engine 对象,并设置要进行分析的模型的根。
metric_engine = slmetric.Engine(); % Include referenced models and libraries in the analysis, % these properties are on by default metric_engine.ModelReferencesSimulationMode = 'AllModes'; metric_engine.AnalyzeLibraries = 1; setAnalysisRoot(metric_engine, 'Root', 'sldemo_mdlref_basic')
收集模型度量数据。
execute(metric_engine, 'mathworks.metrics.ExplicitIOCount');
将模型度量数据作为 slmetric.metric.ResultCollection 对象数组返回,并将其赋值给 res_col。
res_col = getMetrics(metric_engine, 'mathworks.metrics.ExplicitIOCount');
显示 mathworks.metrics.ExplicitIOCount 度量的结果。
for n=1:length(res_col) if res_col(n).Status == 0 result = res_col(n).Results; for m=1:length(result) disp(['MetricID: ',result(m).MetricID]); disp([' ComponentPath: ',result(m).ComponentPath]); disp([' Value: ', num2str(result(m).Value)]); disp([' AggregatedValue: ', num2str(result(m).AggregatedValue)]); disp([' Measures: ', num2str(result(m).Measures)]); disp([' AggregatedMeasures: ', num2str(result(m).AggregatedMeasures)]); end else disp(['No results for:', result(n).MetricID]); end disp(' '); end
对于 ComponentPath: sldemo_mdlref_basic,其值为 3,因为有三个输出。这三个输出位于 Measures 数组的第二个元素中。slmetric.metric.AggregationMode 是 Max,所以 AggregatedValue 是 4,也就是 sldemo_mdlref_counter 的输入和输出数。AggregatedMeasures 数组包含组件或子组件的最大输入和输出数。
版本历史记录
在 R2016a 中推出以后的版本中将会删除度量仪表板用户界面、metricdashboard 函数、slmetric 包 API 以及相应的自定义项。有关详细信息,请参阅从度量盘迁移到模型可维护性仪表盘。
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)