Main Content

na_0003: Usage of If blocks

Since R2020a

Guideline Publication

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

Sub ID Recommendations

  • NA-MAAB — No recommendations

  • JMAAB — a

MATLAB Versions

All

Rule

Sub ID a

For the If block, the if expression and elseif expression shall be used only to define input signals.

Custom Parameter

Not Applicable

Example — Correct

The if expression only defines the input variables.

Example — Incorrect

The if expression defines a comparison operation.

Rationale

Sub ID a:

  • Visual comprehension of control conditions is easier when logical operations are described outside of the If block.

  • Describing logical operations outside of the If block allows verification to focus on the logical operation.

Verification

Model Advisor check: Check logical expressions in If blocks (Simulink Check)

Last Changed

R2020a

Version History

Introduced in R2020a