Main Content

Input and Output Component Interface Ports

Since R2022b

Metric ID

slcomp.InterfacePorts

Description

Use this metric to count the number of input ports and output ports to the component interface.

This metric counts:

  • Simulink® Inport blocks

  • Simulink Outport blocks

  • Input ports for Stateflow® charts

  • Output ports for Stateflow charts

  • Inputs and outputs to MATLAB® code

Supported Artifacts

You can collect this metric for:

To control what the dashboard classifies as a unit or component, see Categorize Models in Hierarchy as Components or Units.

Computation Details

The metric returns the number of component interfaces.

Collection

To collect data for this metric:

  • In the Model Maintainability Dashboard, in the Component Interface section, point to the Input Ports or Output Ports widgets and click the Run metrics for widget icon.

  • Use getMetrics with the metric identifier slcomp.InterfacePorts.

Results

For this metric, instances of metric.Result return the Value as a vector that contains these elements:

  • Value(1) — The number of input component interface ports. This corresponds to the Input Ports widget in the Component Interface section.

  • Value(2) — The number of output component interface ports. This corresponds to the Output Ports widget in the Component Interface section.

The results of this metric correspond to the Input Ports and Output Ports widgets in the Component Interface section.

Examples

Suppose your component is a model that has eleven Inport blocks and five Outport blocks, this metric returns a Result array with a Value property of [11, 5].

See Also

Related Topics