Skip to Main Content Skip to Search
Product Documentation

Operations on Complex Data in Stateflow Action Language

Binary Operations

These binary operations work with complex operands in the following order of precedence (1 = highest, 3 = lowest). For operations with equal precedence, they evaluate in order from left to right.

Example

Precedence

Description

a * b

1

Multiplication

a + b

2

Addition

a - b

2

Subtraction

a == b

3

Comparison, equality

a != b

3

Comparison, inequality

Stateflow action language does not support division of complex operands because this operation requires a numerically stable implementation, especially when the base type of the complex data is fixed-point.

To perform complex division, use a MATLAB function, which provides a numerically accurate and stable result. For details, see Performing Complex Division with a MATLAB Function.

Unary Operations and Actions

These unary operations and actions work with complex operands.

Example

Description

~a

Unary minus

!a

Logical NOT

a++

Increment

a--

Decrement

Assignment Operations

These assignment operations work with complex operands.

Example

Description

a = expression

Simple assignment

a += expression

Equivalent to a = a + expression

a -= expression

Equivalent to a = a - expression

a *= expression

Equivalent to a = a * expression

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS