Why is cyclomatic Complexity of Switch Block 2?
2 views (last 30 days)
Show older comments
Sohil Shrestha
on 19 Jul 2020
Commented: Sohil Shrestha
on 28 Dec 2021
Switch Block has two possible outcomes: input 1 or input 3. The cyclomatic complexity of the block should have been 1 according to its defination in the documentation .
Why does the Simulink check API (slmetrics) return 2 instead of 1. Am i missing something ?
0 Comments
Accepted Answer
Fangjun Jiang
on 20 Jul 2020
A Switch block is an equivilant of an if-else statement. Its cyclomatic complexity number is 2.
3 Comments
More Answers (0)
See Also
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!