Main Content

jc_0657: Retention of output value based on conditional control flow blocks and Merge blocks

Sub ID Recommendations

  • NA-MAAB — a2

  • JMAAB — a1/a2

MATLAB Versions

All

Rule

Sub ID a1

Unused action ports shall connect to Terminator block when these conditions are met:

  • Past value is retained

  • Merge block and a conditional flow block, such as an If or Switch Case block, are used to switch functions.

Custom Parameter

Not Applicable

Example — Correct

If block example

Switch Case block example

Example — Incorrect

If block example

Switch Case block example

Sub ID a2

A feedback loop using a Delay block shall be implemented when these conditions are met:

  • Past value is retained

  • Merge block and a conditional flow block, such as an If or Switch Case block, are used to switch functions.

Custom Parameter

Not Applicable

Example — Correct

If block example

Switch Case block example

Example — Incorrect

If block example

Switch Case block example

Rationale

Sub ID a1:

  • Improves code efficiency.

  • Connections to Terminator block can be used when past values are held other than by the default (else).

Sub ID a2:

  • Retaining past values is explicit.

Verification

Adherence to this modeling guideline cannot be verified by using a Model Advisor check.

Last Changed

R2020a

See Also

Introduced in R2020a