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
Add a data object to your chart, as described in Add Stateflow Data.
Set the Complexity property for the data object to
On
. For more information, see Complexity.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
, andboolean
.
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:
Use Simulink blocks (such as filters) to process complex signals.
Use charts to implement mode logic for frame synchronization.
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.
Note
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:
State actions
Transition actions
MATLAB functions (see Reuse MATLAB Code by Defining MATLAB Functions)
Truth table functions (see Use Truth Tables to Model Combinatorial Logic)
Graphical functions (see Reuse Logic Patterns by Defining Graphical Functions)
Change detection operators (see Detect Changes in Data and Expression Values)
Note
Exported functions do not support complex data as arguments.