Main Content

jc_0702: Use of named Stateflow parameters and constants

Since R2020a

Guideline Publication

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

Sub ID Recommendations

  • NA-MAAB — a

  • JMAAB — a

MATLAB Versions

All

Rule

Sub ID a

Stateflow block shall not use numeric literal.

Exceptions

  • Initial value is 0

  • Increment, decrement 1

Custom Parameter

Not Applicable

Example — Correct

Numeric literals are not used.

Example — Incorrect

Numeric literals are used.

Rationale

Sub ID a:

  • Only the modeler will understand the purpose of the value when numeric literals are used to write constants, which decreases readability.

  • Constants that are intended for calibration are generated in the code using numeric literals.

Verification

Model Advisor check: Check usage of numeric literals in Stateflow (Simulink Check)

Last Changed

R2020a

Version History

Introduced in R2020a