- https://www.mathworks.com/help/slcheck/ref/slcomp.sfcyclomaticcomplexity.html
- https://www.mathworks.com/help/slcheck/ref/slcomp.stateflowdecisions.html#mw_480a1748-25fc-401a-b6c5-c62336a8ca71:~:text=or%20Units.-,Decision%20Counts%20for%20Common%20Stateflow%20Components,-The%20metric%20returns
about cyclomatic complexity of stateflow
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1310865/image.png)
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.)
0 commentaires
Réponses (1)
Akash
le 15 Oct 2024
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.
0 commentaires
Voir également
Catégories
En savoir plus sur Stateflow dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!