Why is cyclomatic Complexity of Switch Block 2?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Fangjun Jiang
2020-7-20
A Switch block is an equivilant of an if-else statement. Its cyclomatic complexity number is 2.
3 个评论
Fangjun Jiang
2020-7-27
Good point! Contact the Mathworks tech support and ask to explain the cases of a Switch block and a multi-port Switch block, i.e. what is N and "On". It seems the documetation has error.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Code Generation for ARM Cortex-M and ARM Cortex-A Processors 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!