Main Content

na_0018: Number of nested if/else and case statement

Since R2020a

Guideline Publication

Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®

Sub ID Recommendations

  • NA-MAAB — a

  • JMAAB — Not supported

MATLAB Versions

All

Rule

Sub ID a

The number of nested levels in if /else and case statements shall be limited, typically to three levels.

Custom Parameter

Maximum nested levels

Rationale

Sub ID a:

  • Improves readability

  • Code generation may not be possible.

Verification

Model Advisor check: Check nested conditions in MATLAB Functions (Simulink Check)

Last Changed

R2020a

Version History

Introduced in R2020a