This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

slmetric.dashboard.Container class

Package: slmetric.dashboard

Widget for holding slmetric.dashboard.Widget and slmetric.dashboard.CustomWidget objects in Metrics Dashboard

Description

An slmetric.dashboard.Container object holds slmetric.dashboard.Widget and slmetric.dashboard.CustomWidget objects. You can use the slmetric.dashboard.Container methods to specify the container size and border.

For example, the image is of the default Metrics Dashboard layout. This portion of the Metrics Dashboard contains an slmetric.dashboard.Group widget with the title Size. This group contains three slmetric.dashboard.Container widgets. The containers on the left and right each contain one slmetric.dashboard.Widget object. The middle container contains two slmetric.dashboard.Widget objects

Construction

container = slmetric.dashboard.Container creates a handle to an slmetric.dashboard.Container object.

Properties

expand all

If true, the slmetric.dashboard.Container object has a border around it in the Metrics Dashboard. This property is read/write.

This widget type is a container. This property is read-only.

Methods

addWidget Add widget to slmetric.dashboard.Container object
getMarginObtain distance from container edge to its contents
getPosition Obtain container position within Metrics Dashboard
getSeparatorsDetermine whether there are lines on sides of Metrics Dashboard container
getWidgetsObtain a list of widgets in an slmetric.dashboard.Container object
getWidths Obtain widths of Metrics Dashboard container
removeWidget Remove widget from slmetric.dashboard.Container object
setMarginSpecify distance from container edge to its contents
setPosition Set container position within Metrics Dashboard
setSeparators Specify lines on Metrics Dashboard container sides
setWidths Specify multiple widths for Metrics Dashboard container

Examples

collapse all

You can use the Metrics Dashboard and metric APIs to obtain compliance and issues metric data on your Model Advisor configuration. To set up your Model Advisor configuration, see Organize Checks and Folders Using the Model Advisor Configuration Editor. You can also use an existing check group such as the MISRA checks. After you have set up your Model Advisor configuration, follow these steps to specify the check groups for which you want to obtain compliance and issues metric data:

Open the default configuration:

config=slmetric.config.Configuration.open()

Specify a metric family ID that you associate with those check groups:

famParamID = 'ModelAdvisorStandard';

Create a cell array consisting of the Check Group IDs that correspond to the check groups. Obtain a Check Group ID by opening up the Model Advisor Configuration Editor and selecting the folder that contains the group of checks. The folder contains a Check Group ID parameter.

values = {'maab', 'hisl_do178', '_SYSTEM_By Task_misra_c'};

The previous cell array specifies MAAB, High-Integrity, and MISRA check groups. The values maab and hisl_do178 correspond to a subset of MAAB and High-Integrity System checks. To include all checks, specify the value for the Check Group ID parameter from the Model Advisor Configuration Editor.

To set up the configuration, pass the values cell array into the setMetricFamilyParameterValues method .

setMetricFamilyParameterValues(config, famParamID, values);

Point the High Integrity Compliance and High Integrity Check Issues widgets to the MISRA check group. To begin, open the default configuration for the Metrics Dashboard layout.

conf = slmetric.dashboard.Configuration.open();

Obtain the slmetric.dashboard.Layout object from the slmetric.dashboard.Configuration object conf.

layout = getDashboardLayout(conf);

Obtain the widget objects that are in the layout object.

layoutWidget=getWidgets(layout);

Obtain the compliance group from the layout. This group contains two containers. The first container contains the High Integrity and MAAB Compliance and Check Issues widgets. Remove the High Integrity Compliance widget.

complianceGroup = layoutWidget(3);
complianceContainers = getWidgets(complianceGroup);
complianceContainerWidgets = getWidgets(complianceContainers(1));
complianceContainers(1).removeWidget(complianceContainerWidgets(1)); 
setMetricIDs(complianceContainerWidgets(1),...
({'mathworks.metrics.ModelAdvisorCompliance._SYSTEM_By Task_misra_c'}));
complianceContainerWidgets(1).Labels={'MISRA'};

Add a custom widget for visualizing MISRA check issues metrics to the complianceContainers slmetric.dashboard.Container object.

misraWidget = complianceContainers(1).addWidget('Custom', 1); 
misraWidget.Title=('MISRA'); 
misraWidget.VisualizationType = 'RadialGauge'; 
misraWidget.setMetricIDs('mathworks.metrics.ModelAdvisorCheckCompliance._SYSTEM_By Task_misra_c'); 
misraWidget.setWidths(slmetric.dashboard.Width.Medium);

Save the configuration objects. These commands serialize the API information to XML files.

save(config,'FileName','MetricConfig.xml');
save(conf,'Filename','DashboardConfig.xml');

Set the active configurations.

slmetric.config.setActiveConfiguration(fullfile(pwd, 'MetricConfig.xml'));
slmetric.dashboard.setActiveConfiguration(fullfile(pwd, 'DashboardConfig.xml'));

For a model, open the Metrics Dashboard.

metricsdashboard sf_car

Click the play button and run metrics.

Introduced in R2018b