Stateflow | ![]() ![]() |
Arrays
You can use arrays in the action language.
Examples of Array Assignments
Use C style syntax in the action language to access array elements.
local_array[1][8][0] = 10; local_array[i][j][k] = 77; var = local_array[i][j][k];
As an exception to this style, scalar expansion is available within the action language. This statement assigns a value of 10 to all of the elements of the array local_array
.
local_array = 10;
Scalar expansion is available for performing general operations. This statement is valid if the arrays array_1
, array_2
and array_3
have the same value for the Sizes property.
array_1 = (3*array_2) + array_3;
Using Arrays with Simulink
Array data objects that have a scope of Input from Simulink or Output to Simulink are constrained to one dimension. Use a single scalar value for the Sizes property of these arrays.
Arrays and Custom Code
The action language provides the same syntax for Stateflow arrays and custom code arrays. Any array variable that is referred to in a Stateflow chart but is not defined in the data dictionary is identified as a custom code variable.
![]() | Data and Event Arguments | Pointer and Address Operators | ![]() |