slmetric.metric.ResultCollection
(To be removed) Metric data for specified model metric
The Metrics Dashboard user interface, metricdashboard
function, slmetric
package API, and corresponding customizations will be removed in a future release. For more information, see Migrating from Metrics Dashboard to Model Maintainability Dashboard.
Description
An slmetric.metric.ResultCollection
object contains the
metric data for a specific model metric.
Creation
To create an slmetric.metric.ResultCollection
object, use getMetrics
on an slmetric.Engine
object.
getMetrics
returns an array of result collection objects for all
metrics that the metric engine executed.
Properties
MetricID
— Metric identifier
character vector
Metric identifier for a MathWorks metric or a custom metric, specified as
a character vector. You can get metric identifiers by calling slmetric.metric.getAvailableMetrics
.
Example: 'mathworks.metrics.SimulinkBlockCount'
Status
— Metric execution status
integer
This property is read-only.
Status code of the metric execution, returned as an integer.
Integer | Status |
---|---|
1 | No result. The metric algorithm is not applicable to the analyzed system. The components analyzed by the metric were not found, or the metric has a compile requirement cannot be executed on the library model. |
0 | Result collected. |
-1 | No result. Error executing metric. |
-2 | No result available from previous run. |
-3 | No result. Compilation error. |
-4 | Empty result. Missing prerequisite. |
Category
— Metric data category based on thresholding criteria
'Compliant'
| 'NonCompliant'
| 'Warning'
| 'Uncategorized'
This property is read-only.
Metric data category, returned as one of these four categories:
Compliant — Metric data that is in an acceptable range.
Warning — Metric data that requires review.
NonCompliant — Metric data that requires you to modify your model.
Uncategorized — Metric data that has no threshold values.
If at least one component is NonCompliant
,
this property returns NonCompliant
. If at least one
component is Warning
and no
components are NonCompliant
, this property returns
Warning
. If all
components are Compliant
, this property returns
Compliant
.
Outdated
— Determine if metric data is current
logical
This property is read-only.
Whether metric data is current, returned as true
or
false
. If true
, the metric data is
out-of-date because the model or source files have changed.
Results
— Metric data collected for executing one or more metrics
array of slmetric.metric.Result
objects
This property is read-only.
Metric data collected when you call the execute
method for one or more metrics, returned as an array of
slmetric.metric.Result
objects.
Examples
Collect and Access Metric Data for One Metric
This example shows how to collect and access metric data for the model sldemo_mdlref_basic
.
Open the sldemo_mdlref_basic
model.
open_system('sldemo_mdlref_basic');
Create an slmetric.Engine
object and set the root in the model for analysis.
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')
Collect model metric data.
execute(metric_engine, 'mathworks.metrics.ExplicitIOCount');
Return the model metric data as an array of slmetric.metric.ResultCollection
objects and assign it to res_col
.
res_col = getMetrics(metric_engine, 'mathworks.metrics.ExplicitIOCount');
Display the results for the mathworks.metrics.ExplicitIOCount
metric.
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
For ComponentPath: sldemo_mdlref_basic
, the value is 3
because there are three outputs. The three outputs are in the second element of the Measures
array. The slmetric.metric.AggregationMode
is Max
, so the AggregatedValue
is 4
, which is the number of inputs and outputs to sldemo_mdlref_counter
. The AggregatedMeasures
array contains the maximum number of inputs and outputs for a component or subcomponent.
Version History
Introduced in R2016aR2022a: Metrics Dashboard will be removed
The Metrics Dashboard user interface, metricdashboard
function, slmetric
package API, and corresponding customizations will be removed in a future release. For more information, see Migrating from Metrics Dashboard to Model Maintainability Dashboard.
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 (한국어)