Model metrics analyze your model and help you assess your model with regard to size, architecture, readability, and compliance to standards. Simulink^{®} Check™ provides the metrics for these metric types:
Using the Metrics Dashboard, you can collect and view model metrics to get an assessment of your project quality status. For more information, see Collect and Explore Metric Data by Using the Metrics Dashboard.
You can use the model metric API to run the model metrics programmatically and export the results to a file. For more information, see Collect Model Metrics Programmatically.
For your company guidelines and standards, you can also use the model metric API to create your own model metrics, compute those metrics, and export the metric data. For more information, see Create a Custom Model Metric for Nonvirtual Block Count.
To collect metric data on a model or subsystem, run these metrics.
Metric  Description 

Simulink block metric 
Calculates the number of blocks in the model. 
Subsystem metric 
Calculates the number of subsystems in the model. 
Library link metric 
Calculates the number of librarylinked blocks in the model. 
Effective lines of MATLAB code metric 
Calculates the number of effective lines of MATLAB^{®} code. 
Stateflow chart objects metric 
Calculates the number of Stateflow^{®} objects. 
Lines of code for Stateflow blocks metric 
Calculates the number of code lines for the following Stateflow blocks in the model:

Subsystem depth metric 
Calculates the subsystem depth of the model. 
Input output metric 
Calculates the number of inports and outports in your model. 
Explicit input output metric 
Calculates the number of inports and outports in your model. 
File metric  Calculates the number of model and library files. 
MATLAB Function metric  Calculates the number of Matlab Function blocks in your model. 
Model file count  Calculates the number of model files. 
Parameter metric  Calculates the number of data objects that parameterize the behavior of a model. 
Stateflow chart metric  Calculates the number of Stateflow charts in your model. 
For more information on model metrics, see Collect Model and Testing Metrics.
To learn more about the architecture for a model or subsystem, run these metrics.
Metric  Description 

Cyclomatic complexity metric 
Calculates the cyclomatic complexity of the model. 
Clone content metric  Calculates the fraction of total number of subcomponents that are clones. 
Clone detection metric  Calculates the number of clones in components across the model hierarchy. 
Library content metric  Calculates the fraction of total number of components that are linked library blocks. 
For more information on model metrics, see Collect Model and Testing Metrics.
To determine if your model or subsystem is compliant with standards and guidelines, run one or more of these metrics.
Metric  Description 

MATLAB code analyzer warnings 
Determines warnings for MATLAB code blocks in your model. 
Diagnostic warnings metric 
Calculates the number of diagnostic warnings reported. 
Model Advisor Check Compliance for HighIntegrity Systems 
Returns the fraction of checks the model passes from Model Advisor DO178C/DO331 Standards. 
Model Advisor Check Compliance for Modeling Standards for MAB  Returns the fraction of checks the model passes from Model Advisor MAB Standard. 
Model Advisor Check Issues for HighIntegrity Systems 
Reports the number of issues from Model Advisor DO178C/DO331 Standards. 
Model Advisor Check Issues for MAB Standards 
Reports the number of issues from Model Advisor MAAB Standard. 
For more information on model metrics, see Collect Model and Testing Metrics.
Run these metrics to determine readability for a model or subsystem.
Metric  Description 

Nondescriptive block name metric 
Determines nondescriptive Inport, Outport, and Subsystem block names. 
Data and structure layer separation metric 
Calculates the data and structure layer separation. 
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.SimulinkBlockCount
Model Advisor Check ID:
mathworks.metricchecks.SimulinkBlockCount
Calculate the number of Simulink blocks in the model
Use this metric to calculate the number of blocks in the model. The results provide the
number of blocks at the model and subsystem level. This metric counts Simulink—based
blocks, but does not include underlying blocks used to implement the block. This metric is
available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.SimulinkBlockCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
To collect data for this metric using the Model Advisor, run the check, Simulink block metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of blocks in the model or the subsystem. The check does not analyze referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of blocks.
AggregatedValue
: Number of blocks for component and its
subcomponents.
Measures
: Not applicable.
Note
The results from metric analysis of Simulink block metric can
differ from calling sldiagnostics
. The result of the Simulink
block metric:
Includes referenced models.
Does not include any underlying blocks used to implement a MathWorks block that you used from the Simulink Library Browser.
Does not include links into MathWorks libraries, which means that MathWorks library blocks that are masked subsystems are counted as one block. The inner content of those blocks is not counted.
Does not include hidden content under Stateflow Charts or MATLAB Function blocks.
Does not include requirements blocks.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.SubSystemCount
Model Advisor Check ID:
mathworks.metricchecks.SubSystemCount
Display number of subsystems in the model
Use this metric to calculate the number of subsystems in the model. The results provide the number of subsystems at the model and subsystem level.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.SubSystemCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
To collect data for this metric using the Model Advisor, run the check, Subsystem metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of subsystems in the model or the subsystem. The check does not analyze referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of subsystems.
AggregatedValue
: Number of subsystems for a component and its
subcomponent.
Measures
: Not applicable.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
Does not count subsystems linked to MathWorks^{®} libraries.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.LibraryLinkCount
Model Advisor Check ID:
mathworks.metricchecks.LibraryLinkCount
Display number of library links in the model
Use this metric to calculate the number of librarylinked blocks in the model. The results provide the number of librarylinked blocks at the model and subsystem level.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.LibraryLinkCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
To collect results for this metric using the Model Advisor, run the check, Library link metric in By Task > Model Metrics > Count Metrics.The Model Advisor check displays the number of library links in the model or the subsystem. The check does not analyze referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of library linked blocks.
AggregatedValue
: Number of library linked blocks for a
component and its subcomponents.
Measures
: Not applicable.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
Does not count subsystems linked to MathWorks libraries.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.MatlabLOCCount
Model Advisor Check ID:
mathworks.metricchecks.MatlabLOCCount
Display number of effective lines of MATLAB code
Run this metric to calculate the number of effective lines of MATLAB code. Effective lines of MATLAB code are lines of executable code. Empty lines, lines that contain only comments, and lines that contain only an end statement are not considered effective lines of code. The results provide the number of effective lines of MATLAB code for each MATLAB Function block and for MATLAB functions in Stateflow charts.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.MatlabLOCCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
To collect results for this metric using the Model Advisor, run the check, Effective lines of MATLAB code metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of effective lines of MATLAB code for each MATLAB Function block and for MATLAB functions in Stateflow charts in the model. The check does not analyze referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of effective lines of MATLAB code.
AggregatedValue
: Number of effective lines of MATLAB code for a component and its subcomponents.
Measures
: Not applicable.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
Does not analyze the content of MATLAB code in external files.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.StateflowChartObjectCount
Model Advisor Check ID:
mathworks.metricchecks.StateflowChartObjectCount
Display the number of Stateflow objects in each chart
Run this metric to calculate the number of Stateflow objects. For each chart in the model, the results provide the number of the following Stateflow objects:
Atomic subcharts
Boxes
Data objects
Events
Graphical functions
Junctions
Linked charts
MATLAB functions
Notes
Simulink functions
States
Transitions
Truth tables
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.StateflowChartObjectCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
To collect results for this metric using the Model Advisor, run the check, Stateflow chart objects metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of Stateflow objects in each chart in the model. The check does not analyze charts in referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of Stateflow objects.
AggregatedValue
: Number of Stateflow objects for a component and its subcomponents.
Measures
: Not applicable.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.StateflowLOCCount
Model Advisor Check ID:
mathworks.metricchecks.StateflowLOCCount
Display the number of effective lines of code for Stateflow blocks
Use this metric to calculate the number of effective lines of code in Stateflow. Effective lines of MATLAB code are lines of executable code. Empty lines, lines that contain only comments, and lines that contain only an end statement are not considered effective lines of code. This metric calculates the lines of code for the following Stateflow blocks in the model:
Chart, counting the code on Transitions and inside States
State Transition Table block
Truth Table block
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.StateflowLOCCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
To collect results for this metric using the Model Advisor, run the check, Lines of code for Stateflow blocks metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of code lines for Stateflow blocks in the model. The check does not analyze referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of Stateflow block code lines.
AggregatedValue
: Number of Stateflow block code lines for a component and its subcomponents.
Measures
: Vector with two entries: number of effective lines of
code in MATLAB action language and number of effective lines of code in C action
language.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.SubSystemDepth
Model Advisor Check ID:
mathworks.metricchecks.SubSystemDepth
Calculates the depth of the hierarchical children of a subsystem or model
Use this metric to count the relative depth of all hierarchical children for a given subsystem or model starting from the given component, or root of analysis. Depth traversal analysis stops when it reaches a referenced model or a library. Depth is restarted with 0 for each of these components.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.SubSystemDepth
.
The slmetric.metric.AggregationMode
property setting is
None
.
To collect results for this metric using the Model Advisor, run the check, Subsystem depth metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the depth of the subsystems in the model. The check does not analyze referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: subsystem depth for each component in the
hierarchy.
AggregatedValue
: Not applicable.
Measures
: Not applicable.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.IOCount
Display number of inputs and outputs in the model
Use this metric to calculate the number of inputs and outputs in the model, which include:
Inputs: Inport blocks, Trigger ports, Enable ports, chart input data and events.
Outputs: Outport blocks, chart output data and events.
Implicit inputs: From block, where the matching Goto block is outside of the component.
Implicit outputs: Goto block, where the matching From block is outside of the component.
The slmetric.metric.AggregationMode
property setting is
Max
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: total interface size or sum of the elements of
Measures
.
AggregatedValue
: Number of inputs and outputs for a component
and its subcomponents.
Measures
: Array consisting of number of inputs, number of
outputs, number of implicit inputs, and number of implicit outputs, which are local to
the component.
AggregatedMeasures
: Maximum number of inputs, outputs, implicit
inputs, and implicit outputs for a component and subcomponents.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Compliance
Metric ID:
mathworks.metrics.DiagnosticWarningsCount
Calculate the number of diagnostic warnings reported during a model update for simulation.
Use this metric to calculate the number of Simulink diagnostic warnings reported during a model update for simulation. This metric
is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.DiagnosticWarningsCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of diagnostic warnings reported.
AggregatedValue
: Number of diagnostic warnings reported for
component and its subcomponents.
Measure
: Not applicable.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.ExplicitIOCount
Display number of inputs and outputs in the model, excluding From and Goto blocks.
Use this metric to calculate the number of inputs and outputs in the model, which include:
Inputs: Inport blocks, Trigger ports, Enable ports, chart input data and events.
Outputs: Outport blocks, chart output data and events.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.ExplicitIOCount
.
The slmetric.metric.AggregationMode
property setting is
Max
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Total interface size or sum of the elements of
Measures
.
AggregatedValue
: Number of inputs and outputs for a component
and its subcomponents.
Measures
: Array consisting of number of inputs and number of
outputs which are local to the component.
AggregatedMeasures
: Maximum number of inputs and outputs for a
component and subcomponents.
The metric:
Excludes From and Goto blocks.
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.FileCount
Calculates the number of model and library files used by a specific component and its subcomponents.
Use this metric to count the number of model and library files used by a specific
component and its subcomponents. This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.FileCount
.
The slmetric.metric.AggregationMode
property setting is
None
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of model and library files.
AggregatedValue
: Not applicable.
Measures
: Not applicable.
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.MatlabFunctionCount
Calculates the number of Matlab Function blocks inside a component.
Use this metric to count the number of Matlab Function blocks inside a
component. This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.MatlabFunctionCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of Matlab Function blocks.
AggregatedValue
: Number of Matlab Function
blocks for component and its subcomponents.
Measures
: Not applicable.
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.ModelFileCount
Calculate the number of model files.
Use this metric to count the number of model files. This metric is available with
Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.ModelFileCount
.
The slmetric.metric.AggregationMode
property setting is
None
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of files reference by a component and its
subcomponents.
AggregatedValue
: Not applicable.
Measures
: Not applicable.
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.ParameterCount
Calculate the number of parameters.
Use this metric to calculate the amount of usermanaged parameterization data inside a
Simulink system. A parameter is a variable used by a Simulink block or object of a basic type (single
,
double
, uint8
, uint16
,
uint32
, int8
, int16
,
int32
, boolean
, logical
,
struct
, char
, cell
),
Simulink.Parameter
, Simulink.Variant
, or
enum
value. The parameter can be stored in either the base workspace,
the model workspace, or a data dictionary.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.ParameterCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of parameters used inside a component.
AggregatedValue
: Number of parameters for a component and its
subcomponents.
Measures
: Not applicable.
This metric:
Uses the Simulink.findVars
function and inherits
the limitations of this function.
Counts the parameter instances in a component rather than unique parameters.
Does not include parameters in masked workspaces.
Does not include data type and signal objects.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Size
Metric ID:
mathworks.metrics.StateflowChartCount
Calculate the number of Stateflow charts at any component level.
Use this metric to count the number of Stateflow charts at any component level. This metric
is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.StateflowChartCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of Stateflow charts at the model level.
AggregatedValue
: Number of charts for component and its
subcomponents.
Measures
: Not applicable.
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Architecture
Metric ID:
mathworks.metrics.CyclomaticComplexity
Model Advisor Check ID:
mathworks.metricchecks.CyclomaticComplexity
Display the cyclomatic complexity of the model
Use this metric to calculate the cyclomatic complexity of the model. Cyclomatic complexity is a measure of the structural complexity of a model. The complexity measure can be different for the generated code than for the model due to code features that this analysis does not consider, such as consolidated logic and error checks. To compute the cyclomatic complexity of an object (such as a block, chart, or state), Simulink Check uses this formula:
N is the number of decision points that the object represents and o_{n} is the number of outcomes for the nth decision point. The calculation considers a vectorized operation or a Multiport switch block as a single decision point. The tool adds 1 to the complexity number for models, atomic subsystems, and Stateflow charts.
The results provide the local and aggregated cyclomatic complexity for the:
Model
Subsystems
Charts
MATLAB functions
Local complexity is the cyclomatic complexity for objects at their hierarchical level. Aggregated cyclomatic complexity is the cyclomatic complexity of an object and its descendants
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.CyclomaticComplexity
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
To collect data for this metric using the Model Advisor, run the check, Cyclomatic complexity metric in By Task > Model Metrics > Complexity Metrics. The Model Advisor check displays the local cyclomatic complexity for the root model and for Simulink and Stateflow objects in the system. The check does not analyze referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Local cyclomatic complexity.
AggregatedValue
: Aggregated cyclomatic complexity.
Measures
: Not applicable.
The metric:
Does not run on library models.
Analyzes content in masked subsystems.
Does not analyze inactive variants.
If specified, analyzes the content of librarylinked blocks or referenced models.
Does not analyze referenced models in accelerated mode.
Cyclomatic Complexity for Stateflow Charts (Simulink Coverage)
Specify Coverage Options (Simulink Coverage)
Metric Type: Architecture
Metric ID:
mathworks.metrics.CloneContent
Calculates the fraction of total number of subcomponents that are clones.
Use this metric to calculate the fraction of the total number of subcomponents that are clones. Clones must have identical block types and connections but they can have different parameter values. For more information on clone detection, see Enable Component Reuse by Using Clone Detection.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.CloneContent
.
The slmetric.metric.AggregationMode
property setting is
None
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Fraction of total number of subcomponents that are
clones
AggregatedValue
: Not applicable.
Measures
: Vector containing number of clones, total number of
components, and clone group number.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Architecture
Metric ID:
mathworks.metrics.CloneDetection
Calculate the number of clones in a model.
Use this metric to count the number of clones in a model. Clones must have identical
block types and connections but they can have different parameter values. This metric is
available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.CloneDetection
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of clones.
AggregatedValue
: Number of clones for component and its
subcomponents.
Measures
: Not applicable.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Architecture
Metric ID:
mathworks.metrics.LibraryContent
Calculates the fraction of total number of components that are linked library blocks.
Use this metric to calculate the fraction of total number of components that are linked
library blocks. This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.LibraryContent
.
The slmetric.metric.AggregationMode
property setting is
None
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Fraction of the total number of subcomponents that are
linked library blocks.
AggregatedValue
: Not applicable.
Measures
: Vector containing the number of linked library blocks
and total number of components
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics.
Metric Type: Readability
Metric ID:
mathworks.metrics.DescriptiveBlockNames
Model Advisor Check ID:
mathworks.metricchecks.DescriptiveBlockNames
Display nondescriptive Inport, Outport, and Subsystem block names
Run this metric to determine nondescriptive Inport, Outport, and Subsystem block names. Default names appended with an integer are nondescriptive block names. The results provide the nondescriptive block names at the model and subsystem levels.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.DescriptiveBlockNames
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
To collect results for this metric using the Model Advisor, run the check, Nondescriptive block name metric in By Task > Model Metrics > Readability Metrics. The Model Advisor check displays the number of nondescriptive Inport, Outport, and Subsystem block names in the model or subsystem. The check does not display the result for each type of block separately. The check does not analyze referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of nondescriptive Inport, Outport, and Subsystem
block names.
AggregatedValue
: Number of nondescriptive Inport, Outport, and
Subsystem block names for a component and its subcomponents.
Measures
: 1D vector containing:
Total number of Inport blocks
Number of Inport blocks with nondescriptive names
Total number of Outport blocks
Number of Outport blocks with nondescriptive names
Total number of Subsystem blocks
Number of Subsystem blocks with nondescriptive names
AggregatedMeasures
: 1D vector containing sum of:
Total number of Inport blocks
Number of Inport blocks with nondescriptive names
Total number of Outport blocks
Number of Outport blocks with nondescriptive names
Total number of Subsystem blocks
Number of Subsystem blocks with nondescriptive names
The metric:
Does not run on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics
Metric Type: Readability
Metric ID:
mathworks.metrics.LayerSeparation
Model Advisor Check ID:
mathworks.metricchecks.LayerSeparation
Display data and structure layer separation
Run this metric to calculate the data and structure layer separation. The results provide the separation at the model and subsystem level.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.LayerSeparation
.
For guidelines about blocks on model levels, see the MAB guideline db_0143: Usable block types in model hierarchy.
The slmetric.metric.AggregationMode
property setting is
Sum
.
To collect results for this metric using the Model Advisor, run the check, Data and structure layer separation metric in By Task > Model Metrics > Readability Metrics. The Model Advisor check displays the separation for the model or subsystem. The check does not analyze referenced models or return aggregated results.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of basic blocks on a structural level.
AggregatedValue
: Number of basic blocks on a structural level
for a component and its subcomponents.
Measures
: Not applicable.
The metric:
Does not run on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
For more information on model metrics, see Collect Model and Testing Metrics
Metric Type: Compliance
Metric ID:
mathworks.metrics.MatlabCodeAnalyzerWarnings
Use this metric to calculate the number of MATLAB code analyzer warnings from MATLAB code in the model. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Sum
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of MATLAB code analyzer warnings
AggregatedValue
: Number of MATLAB code analyzer warnings
aggregated for a component and subcomponents.
Measures
: Not applicable.
The metric:
Analyzes MATLAB code in MATLAB Function blocks
Analyzes MATLAB functions in Stateflow charts
Runs on library models
Analyzes content in masked subsystems
If specified, analyzes content of librarylinked blocks and referenced models
Does not analyze external MATLAB code files
Metric Type: Compliance
Metric ID:
mathworks.metrics.ModelAdvisorCheckCompliance.hisl_do178
Use this metric to calculate the fraction of Model Advisor checks that pass for the HighIntegrity Systems subgroups. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Percentile
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Fraction of total number of checks passed in
HighIntegrity Systems subgroups.
AggregatedValue
: Fraction of total number of checks passed in
HighIntegrity Systems subgroups aggregated for a component and
all of its subcomponents.
Measures
: Vector containing: number of checks passed in
subgroups and number of checks in subgroups.
AggregatedMeasures
: Vector containing: number of checks passed
in subgroups and number of checks in subgroup, for a component and
all its subcomponents.
For this metric, instances of the slmetric.metric.ResultDetail
Value
property provides these results:
A value of 0 indicates that a check did not run.
A value of 1 indicates that a check passed.
A value of 2 indicates a check warning.
A value of 3 indicates a failure.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
Analyzes content in Stateflow objects.
Metric Type: Compliance
Metric ID:
mathworks.metrics.ModelAdvisorCheckCompliance.maab
Use this metric to calculate the fraction of Model Advisor checks that pass for the group Modeling Standards for MAB. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Percentile
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Fraction of total number of checks passed in MAB.
AggregatedValue
: Fraction of total number of checks passed in
MAB aggregated for a component and all of its
subcomponents.
Measures
: Vector containing: number of checks passed in group
and number of checks in group.
AggregatedMeasures
: Vector containing: number of checks passed
in group and number of checks in group, for a component and
all its subcomponents.
For this metric, instances of the slmetric.metric.ResultDetail
Value
property provides these results:
A value of 0 indicates that a check did not run.
A value of 1 indicates that a check passed.
A value of 2 indicates a check warning.
A value of 3 indicates a failure.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
Analyzes content in Stateflow objects.
Metric Type: Compliance
Metric ID:
mathworks.metrics.ModelAdvisorCheckIssues.hisl_do178
Use this metric to calculate number of issues reported by the subgroups of Model Advisor checks for HighIntegrity Systems. This metric counts each Model Advisor check that produces a warning or failure. If a check contains links to blocks, this metric counts one issue for each linked block. Checks with links to the model are highlighted in the Simulink Editor. If a check does not contain links to blocks, this metric counts one issue. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Sum
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of issues reported by the
HighIntegrity Systems checks
AggregatedValue
: Number of issues reported by the
HighIntegrity Systems checks aggregated for a component and
all of its subcomponents.
Measures
: Not applicable.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
Analyzes content in Stateflow objects.
Metric Type: Compliance
Metric ID:
mathworks.metrics.ModelAdvisorCheckIssues.maab
Use this metric to calculate number of issues reported by the group of Model Advisor checks for Modeling Standards for MAB. This metric counts each Model Advisor check that produces a warning or failure. If a check contains links to blocks, this metric counts one issue for each linked block. Checks with links to the model are highlighted in the Simulink Editor. If a check does not contain links to blocks, this metric counts one issue. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Sum
.
For this metric, instances of slmetric.metric.Result
provide the following results:
Value
: Number of issues reported by the Model Advisor for MAB
checks.
AggregatedValue
: Number of issues reported by the Model Advisor
for MAB checks aggregated for a component and its subcomponents.
Measures
: Not applicable.
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of librarylinked blocks or referenced models.
Analyzes content in Stateflow objects.
Adds check issues on the configuration set or issues with data objects to the issue count at the model root level.