Why is cyclomatic Complexity of Switch Block 2?

2 ビュー (過去 30 日間)
Sohil Shrestha
Sohil Shrestha 2020 年 7 月 19 日
コメント済み: Sohil Shrestha 2021 年 12 月 28 日
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 ?

採用された回答

Fangjun Jiang
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
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.
Sohil Shrestha
Sohil Shrestha 2021 年 12 月 28 日
They updated the documentation based on my feedback.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCode 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!

Translated by