Contents

na_0001: Bitwise Stateflow operators

ID: Title

na_0001: Bitwise Stateflow® operators

Priority

Strongly recommended

Scope

MAAB

MATLAB Versions

All

Prerequisites

None

Description

The bitwise Stateflow operators (&, |, and ^) should not be used in Stateflow charts unless you want bitwise operations:

To enable bitwise operations,

  1. Select File > Chart Properties.

  2. Select Enable C-bit operations.

Correct

Use && and || for Boolean operation.

Use & and | for bit operation.

Incorrect

Use & and | for Boolean operation.

Rationale

  • Readability

  • Verification and Validation

  • Code Generation

Last Changed

V2.2

Model Advisor Check

By Task > Modeling Standards for MAAB > Stateflow > Check for bitwise operations in Stateflow charts

Was this topic helpful?