getWidths

Class: slmetric.dashboard.Container
Package: slmetric.dashboard

Obtain widths of Metrics Dashboard container

Description

Widths = getWidths(containerName) returns an slmetric.dashboard.Width object array consisting of four enumerations. Use the slmetric.dashboard.Container.setWidths method to set the width sizes. You can set between one and four sizes. If you set just one size, the array contains four of the same enumerations. These are the possible enumeration values:

  • slmetric.dashboard.Width.ExtraSmall

  • slmetric.dashboard.Width.Small

  • slmetric.dashboard.Width.Medium

  • slmetric.dashboard.Width.Large

  • slmetric.dashboard.Width.XLarge

  • slmetric.dashboard.Width.XXLarge

These values correspond to the sizes that a container can have as the screen size changes. If the container has one value, the container always has the same size regardless of the screen size. If the container has four different values, the container size can change four times as you maximize or minimize the screen.

Input Arguments

expand all

Container for which you want to obtain widths

Data Types: char

Output Arguments

expand all

slmetric.dashboard.Width enumeration array consisting of between one and four of these values:

  • slmetric.dashboard.Width.ExtraSmall

  • slmetric.dashboard.Width.Small

  • slmetric.dashboard.Width.Medium

  • slmetric.dashboard.Width.Large

  • slmetric.dashboard.Width.XLarge

  • slmetric.dashboard.Width.XXLarge

Examples

expand 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 Use the Model Advisor Configuration Editor to Customize the Model Advisor. 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 MAB, High-Integrity, and MISRA check groups. The values maab and hisl_do178 correspond to a subset of MAB 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 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 MAB 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 your model, open the Metrics Dashboard.

metricsdashboard sf_car

Click the All Metrics button and run all metrics.

Introduced in R2018b