Main Content

setAnalysisRoot

Class: slmetric.Engine
Namespace: slmetric

(To be removed) Specify model or subsystem for metric analysis

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

Specify the model or subsystem for slmetric.Engine metric object analysis.

setAnalysisRoot(metric_engine,'Root',root) specifies the metric analysis root.

For an slmetric.Engine object, before you set the ModelReferencesSimulationMode and AnalyzeLibraries properties, specify the setAnalysisRoot method. The setAnalysisRoot method persists between model runs. If you change these property values and then apply the setAnalysisRoot method, the original values override the new values. For example, for one run, suppose you set these values:

openExample('simulink_general/VanDerPolOscillatorExample');
metric_engine = slmetric.Engine(); 
setAnalysisRoot(metric_engine,'Root','vdp');
metric_engine.ModelReferencesSimulationMode = 'AllModes'; 
metric_engine.AnalyzeLibraries = true;
For the next run, if you want to change the ModelReferencesSimulationMode or the AnalyzeLibraries properties, be sure to first specify the setAnalysisroot method:
openExample('simulink_general/VanDerPolOscillatorExample');
metric_engine = slmetric.Engine(); 
setAnalysisRoot(metric_engine,'Root','vdp');
metric_engine.AnalyzeModelReferences = false; 
metric_engine.AnalyzeLibraries = false;  

example

setAnalysisRoot(metric_engine,'Root',root,Name,Value) specifies the metric analysis root by using Name,Value pairs.

example

Input Arguments

expand all

When you call execute, metric_engine collects metric data for all MathWorks® metrics or for the specified MetricIDs. Calling getMetrics accesses the collected metric data in metric_engine.

Comma-separated Name,Value argument specifying model or subsystem path. Name is the argument name and Value is the corresponding value. Name must appear inside quotes.

Comma-separated Name,Value argument specifying the RootType

Examples

expand all

This example shows how to specify a model for metric analysis.

Open the model vdp by entering:

openExample('simulink_general/VanDerPolOscillatorExample')

Create an slmetric.Engine object.

metric_engine = slmetric.Engine();

Specify the model vdp as the root model for metric analysis.

setAnalysisRoot(metric_engine,'Root','vdp');

This example shows how specify a subsystem for metric analysis.

Open the model sl_subsys_semantics by entering:

openExample('simulink_features/SimulinkSubsystemSemanticsExample')

Create an slmetric.Engine object.

metric_engine = slmetric.Engine();

Set the subsystem enab1 as the root for metric analysis.

Subsys = 'sl_subsys_enab1/enab1';
setAnalysisRoot(metric_engine,'Root',Subsys,'RootType','Subsystem');

Version History

Introduced in R2016a

collapse all

R2022a: 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.