Main Content

jc_0655: Prohibition of logical value comparison in Stateflow

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

Logical constants shall not be compared to each other.

Custom Parameter

Not Applicable

Example — Correct

Logical constants are not compared to each other.

Example — Incorrect

Logical constants are compared to each other.

Rationale

Sub ID a:

  • Readability improves with consistent use of boolean-valued signal==true(boolean type constant) or (boolean-valued signal) for logical signal condition expressions.

  • Prevents redundancy in the model.

  • Deviation from the rule can cause unexpected issues.

Verification

Model Advisor check: Check prohibited comparison operation of logical type signals (Simulink Check)

Last Changed

R2020a

Version History

Introduced in R2020a