Main Content

Stateflow Decision Count

Since R2022b

Metric ID

slcomp.StateflowDecisions

Description

For a given unit or component, this metric determines the number of Stateflow® decisions in each Stateflow:

  • Chart

  • Atomic subchart

  • Atomic box in a subchart

  • Linked atomic subchart

  • State Transition Table

  • Truth Table

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.

Decision Counts for Stateflow Components

The metric returns both graphical decisions and code decisions. Graphical decisions are decisions based on the graphical connections in the Stateflow chart. Code decisions are decisions based on the code written in MATLAB® or C, depending on the action language of the Stateflow chart.

This table shows how the metric calculates the decision count for Stateflow components.

 Decision Counts Table

Computation Details

This metric is a heuristic that estimates the number of Stateflow decisions. The calculated decision count is not exact.

The metric:

  • Does not compile the model. The metric only considers static information.

  • Ignores Stateflow states and transitions that have syntax errors.

  • Ignores transitions with empty triggers.

  • Ignores trigger statements that are commented out or only contain '?'.

  • Ignores commented out Stateflow objects.

The metric aligns with the decision coverage returned by Simulink® Coverage™. For information, see Model Coverage for Stateflow Charts (Simulink Coverage).

Collection

To collect data for this metric, use getMetrics with the metric identifier slcomp.StateflowDecisions.

metric_engine = metric.Engine;
execute(metric_engine,"slcomp.StateflowDecisions");
results = getMetrics(metric_engine,"slcomp.StateflowDecisions")

Results

This metric returns metric results for each unit and component in the project.

For each unit and component, the metric returns a metric.Result object with these properties:

  • Value — Structure with these fields:

    • GraphicalDecisions — Number of graphical decisions

    • CodeDecisions — Number of code decisions

    • TotalDecisions — Total number of Stateflow decisions

  • Scope — Structure with information about the unit or component

Examples

To see the number of Stateflow decisions associated with different Stateflow components, see Decision Counts for Stateflow Components.

See Also

| | | |

Topics