This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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

By Task > Modeling Standards for MAAB > Stateflow > Check reuse of Variables within a Stateflow scope

For check details, see Check reuse of variables within a Stateflow scope (Simulink Check).

Introduced in R2010a