Stateflow    

Supported Operations with Fixed-Point Operands

Stateflow supports the following operations for fixed-point operands:

Binary Operations

Stateflow supports the following binary operations with the listed precedence:

Example
Precedence
Description
a * b
10
Multiplication
a / b
10
Division
a + b
9
Addition
a - b
9
Subtraction
a > b
7
Comparison, greater than
a < b
7
Comparison, less than
a >= b
7
Comparison, greater than or equal to
a <= b
7
Comparison, less than or equal to
a == b
6
Comparison, equality
a ~= b
6
Comparison, inequality
a != b
6
Comparison, inequality
a <> b
6
Comparison, inequality
a & b
5
One of the following:
  • Bitwise AND
  • Enabled when Enable C-like bit operations is selected in the chart properties dialog. See Specifying Chart Properties. Operands are cast to integers before the operation is performed.

  • Logical AND
  • Enabled when Enable C-like bit operations is cleared in chart properties dialog.

a | b
3
One of the following:
  • Bitwise OR
  • Enabled when Enable C-like bit operations is selected in chart properties dialog. See Specifying Chart Properties. Operands are cast to integers before the operation is performed.

  • Logical OR
  • Enabled when Enable C-like bit operations is cleared in chart properties dialog.

a && b
2
Logical AND
a || b
1
Logical OR

Unary Operations and Actions

Stateflow supports the following unary operations and actions:

Example
Description
~a
Unary minus
!a
Logical not
a++
Increment
a--
Decrement

Assignment Operations

Stateflow supports the following assignment operations:

Example
Description
a = expression
Simple assignment
a := expression
See Assignment Operator :=.
a += expression

Equivalent to a = a + expression

a -= expression

Equivalent to a = a - expression

a *= expression

Equivalent to a = a * expression

a /= expression

Equivalent to a = a / expression

a |= expression
Equivalent to a = a | expression (bit operation). See operation a | b in Binary Operations.
a &= expression
Equivalent to a = a & expression (bit operation). See operation a & b in Binary Operations.


  Fixed-Point Context-Sensitive Constants Promotion Rules for Fixed-Point Operations