Contenuto principale

Stateflow Design Information

R2026b
Since R2026b

Metric ID

sfdesignlayer.StateflowDesignInfo

Description

This metric summarizes design information for Stateflow® charts. The metric combines multiple Stateflow design metrics into a single result to help you assess the size, architecture, and complexity of your Stateflow charts and related artifacts.

For each Stateflow design layer, the metric returns the:

  • Number of states

  • Number of transitions

  • Number of decisions, including graphical and code

  • Number of effective lines of code (eLOC)

  • Number of interface ports

  • Halstead complexity metrics

A Stateflow design layer is an artifact, such as a Stateflow chart, state, or truth table, that has its own canvas in Stateflow.

Supported Artifacts

You can collect this metric for Units and Components. To control what the dashboard classifies as a unit or component, see Categorize Models in Hierarchy as Components or Units.

Computation Details

The metric combines metric data from these individual metrics:

Collection

To collect data for this metric, execute the metric engine using the metric ID.

metric_engine = metric.Engine;
results = execute(metric_engine,"sfdesignlayer.StateflowDesignInfo")

Results

The metric returns results for each Stateflow design layer in the units and components in your project. For each design layer, the metric returns a metric.Result object.

The Value property is a structure with these fields:

  • States — Number of Stateflow states

  • Transitions — Number of Stateflow transitions

  • GraphicalDecisions — Number of graphical decisions

  • CodeDecisions — Number of code decisions

  • EffectiveLinesOfCode — Number of effective lines of code (eLOC) in the design layer, excluding comments, blank lines, brace-only lines, and structural headers. The metric counts lines, not statements. A line with multiple statements counts as one effective line of code.

  • InterfacePorts — Structure with these fields:

    • In — Number of Stateflow data objects with scope 'input'

    • Out — Number of Stateflow data objects with scope 'output'

  • Halstead — Structure with these fields:

    • TotalOperators — Number of Stateflow operators and MATLAB® operators

    • TotalOperatorsSF — Number of Stateflow operators

    • TotalOperatorsML — Number of MATLAB operators

    • UniqueOperators — Number of unique Stateflow operators and MATLAB operators

    • UniqueOperatorsSF — Number of unique Stateflow operators

    • UniqueOperatorsML — Number of unique MATLAB operators

    • TotalOperands — Number of Stateflow operands and MATLAB operands

    • TotalOperandsSF — Number of Stateflow operands

    • TotalOperandsML — Number of MATLAB operands

    • UniqueOperands — Sum of unique Stateflow operands, UniqueOperandsSF, and unique MATLAB operands, UniqueOperandsML

    • UniqueOperandsSF — Each operand in Stateflow is unique, so UniqueOperandsSF is equal to TotalOperandsSF

    • UniqueOperandsML — Number of unique MATLAB operands

    • Volume — Size of the design layer

    • Difficulty — Estimate of how difficult the design layer is to read and write

See Also

Objects

Functions

Topics