about cyclomatic complexity of stateflow

3 次查看(过去 30 天)
As shown in the figure above, how to calculate the cyclomatic complexity of chart and chart2, and why chart4 equals 4 but chart2 equals 6?(both of them contain a trigger, so the cyclomatic complexity is 1 more. If no trigger, the cyclomatic complexity of chart is 3, chart2 is 5.)

回答(1 个)

Akash
Akash 2024-10-15
Hi Chenchen,
The cyclomatic complexity in Stateflow is determined by summing the number of graphical Stateflow decisions and the number of MATLAB code decisions within the Stateflow component, and then adding one for the default path. Graphical decisions are those based on the connections drawn within a Stateflow chart, while MATLAB code decisions are based on code written in the MATLAB action language.
For more information on calculation of cyclomatic complexity in Stateflow, you can refer the following documentation:
These resources include a decision count table that shows how the metric calculates decision counts for the common Stateflow components.

类别

Help CenterFile Exchange 中查找有关 Stateflow 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by