Stateflow | ![]() ![]() |
Defining Data Arrays
Stateflow allows you to define arrays of data.
Sizes
property to the size of each of the array's dimensions (Setting Data Properties).
For example, to define a 100-element vector, set the Sizes
property to 100
.
To define a 2-by-4 array, set the Sizes
property to [2 4]
.
Initial Index
property to the index of the array's first element.
For example, to define a zero-based array, set the Initial Index
property
to 0
.
For example, to specify that an array's elements be initialized to zero, set the
Initialized from option in the Data dialog box to data dictionary
and the
enter 0
in the adjacent text field.
Example
Suppose that you want to define a local, 4-by-4, zero-based array of type Integer
named rotary_switches
. Further, suppose that each element of the array was initially 1 and could have no values less than 1 or greater than 10. The following Data dialog box shows the settings for such an array.
![]() | Data Dialog Box | Defining Input Data | ![]() |