Main Content

Complex Data in Stateflow Charts

Complex data is data whose value is a complex number. For example, in a Stateflow® chart in Simulink® model, an input signal with the value 3 + 5i is complex. See Complex Signals (Simulink).

Define Complex Data

  1. Add a data object to your chart, as described in Add Stateflow Data.

  2. Set the Complexity property for the data object to On. For more information, see Complexity.

  3. Specify the name, scope, size, base type, and other properties for the data object, as described in Set Data Properties.

    • Complex data does not support the scope Constant.

    • Complex data does not support the base types ml, struct, and boolean.

When to Use Complex Data

Use complex data when you model applications in communication systems and digital signal processing. For example, you can use this design pattern to model a frame synchronization algorithm in a communication system:

  1. Use Simulink blocks (such as filters) to process complex signals.

  2. Use charts to implement mode logic for frame synchronization.

  3. Let the charts access complex input and output data so that nested MATLAB® functions can drive the mode logic.

For an example of modeling a frame synchronization algorithm, see Detect Valid Transmission Data by Using Frame Synchronization.


Continuous-time variables of complex type are not supported. For more information, see Store Continuous State Information in Local Variables.

Where You Can Use Complex Data

You can define complex data at these levels of the Stateflow hierarchy:

  • Charts

  • Subcharts

  • States

  • Functions

How You Can Use Complex Data

You can use complex data to define:

  • Complex vectors

  • Complex matrices

You can also use complex data as arguments for:


Exported functions do not support complex data as arguments.

Related Topics