Stateflow Design Information
R2026bMetric 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 statesTransitions— Number of Stateflow transitionsGraphicalDecisions— Number of graphical decisionsCodeDecisions— Number of code decisionsEffectiveLinesOfCode— 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® operatorsTotalOperatorsSF— Number of Stateflow operatorsTotalOperatorsML— Number of MATLAB operatorsUniqueOperators— Number of unique Stateflow operators and MATLAB operatorsUniqueOperatorsSF— Number of unique Stateflow operatorsUniqueOperatorsML— Number of unique MATLAB operatorsTotalOperands— Number of Stateflow operands and MATLAB operandsTotalOperandsSF— Number of Stateflow operandsTotalOperandsML— Number of MATLAB operandsUniqueOperands— Sum of unique Stateflow operands,UniqueOperandsSF, and unique MATLAB operands,UniqueOperandsMLUniqueOperandsSF— Each operand in Stateflow is unique, soUniqueOperandsSFis equal toTotalOperandsSFUniqueOperandsML— Number of unique MATLAB operandsVolume— Size of the design layerDifficulty— Estimate of how difficult the design layer is to read and write