Main Content

exportMetrics

Class: slmetric.Engine
Namespace: slmetric

(To be removed) Export model metrics

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

Export model metric data to an XML file.

exportMetrics(metric_engine,filename) exports an XML filename containing metric data to your current folder.

example

exportMetrics(metric_engine,filename,filelocation) exports an XML filename containing metric data to filelocation.

example

Input Arguments

expand all

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

Name of XML file.

Example: 'MyMetrics.xml'

Path to XML file

Example: 'C:/mywork'

Examples

expand all

This example shows how to export metrics for model vdp to XML file MyMetrics.xml in your current folder.

Open the model vdp by entering:

openExample('simulink_general/VanDerPolOscillatorExample')

Create an slmetric.Engine object.

metric_engine = slmetric.Engine();

Specify model for metric analysis.

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

Collect the model metrics.

execute(metric_engine);

Get the model metric results.

rc = getMetrics(metric_engine);

Export the metric data to an XML file named myMetrics.xml.

exportMetrics(metric_engine, 'MyMetrics.xml');

This example shows how to export metrics for model vdp to XML file MyMetrics.xml in a specified folder, C:/work.

Open the model vdp by entering:

openExample('simulink_general/VanDerPolOscillatorExample')

Create an slmetric.Engine object.

metric_engine = slmetric.Engine();

Specify model for metric analysis.

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

Collect the model metrics.

execute(metric_engine);

Get the model metric results.

rc = getMetrics(metric_engine);

Export the metric data to an XML file named myMetrics.xml in C:/work.

exportMetrics(metric_engine, 'MyMetrics.xml', 'C:/work');

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.