| Stateflow User's Guide | ![]() |
Sharing Input and Output Data with Simulink
In Setting Data Properties in the Data Dialog, you define data in its properties dialog. In this topic, you continue to use the properties dialog to define Stateflow data that is input from or output to the Simulink model.
Input data is data that a Simulink model supplies to a chart with input ports on the chart block. Output data is data that a chart supplies to other blocks via its output ports. The following example shows a Stateflow chart block with input and output data ports connected to the Simulink model.
To define data as input from or output to Simulink, do the following:
By default, Stateflow associates the first input port with the first input item you define, the second input port with the second input item, and so on. The same applies to output ports. Both the Model Explorer and the Data dialog show the current port assignment in the Port field. You can alter this assignment by editing the value displayed in the Port field.
If the Use Strong Data Typing with Simulink I/O option for the chart is selected (see Specifying Chart Properties), the following apply:
If the Use Strong Data Typing with Simulink I/O option is not selected for the chart, the following apply:
If you specify the size of input or output data directly by a mathematical expression, you can set it to be a scalar or a matrix (two-dimensional, row-by-column array). The size of the Simulink signal connected to a Stateflow input port must match the size of the Stateflow data associated with the port. The size of Stateflow data associated with an output port must match the size expected by the destination block in Simulink it is connected to.
Data arrays you specify with only one dimension are compatible with Simulink row or column vectors of the same size. For example, if Stateflow defines input or output data of size 3, it is compatible with a Simulink row vector of size [1,3], or column vector of size [3,1].
| Sharing Stateflow Data with Simulink and MATLAB | Resolving Signal Objects for Output Data | ![]() |
© 1994-2005 The MathWorks, Inc.