Contents

jc_0491: Reuse of variables within a single Stateflow scope

ID: Title

jc_0491: Reuse of variables within a single Stateflow® scope

Priority

Recommended

Scope

MAAB

MATLAB Versions

All

Prerequisites

None

Description

The same variable should not have multiple meanings (usages) within a single Stateflow state.

Correct

Variable of loop counter must not be used other than loop counter.

Incorrect

The meaning of the variable i changes from the index of the loop counter to the sum of a+b.

Correct

tempVar is defined as local scope in both SubState_A and SubState_B.

Rationale

  • Readability

  • Verification

  • Code Generation

Last Changed

V2.2

Model Advisor Check

Not applicable

Was this topic helpful?