Technical data
Appendix
27.3 Data Types and Parameter Types
Programming with STEP 7
602 Manual, 05/2010, A5E02789666-01
Example 2
An array can also describe a multi-dimensional group of data types. The following figure shows a
two-dimensional array of integers.
You access the data in a multi-dimensional array using the index. In this example, the first integer
is Op_temp[1,1], the third is Op_temp[1,3], the fourth is Op_temp[2,1], and the sixth is
Op_temp[2,3].
You can define up to a maximum of 6 dimensions (6 indexes) for an array. You could, for example,
define the variable Op_temp as follows as a six-dimensional array:
ARRAY [1..3,1..2,1..3,1..4,1..3,1..4]
The index of the first element in this array is Op_temp[1,1,1,1,1,1]. The index of the last element
Op_temp[3,2,3,4,3,4].
Creating Arrays
You define arrays when you declare the data in a DB or in the variable declaration. When you
declare the array, you specify the keyword (ARRAY) followed by the size in square brackets, as
follows:
[lower limit value..upper limit value]
In a multi-dimensional array you also specify the additional upper and lower limit values and
separate the individual dimensions with a comma. The following figure shows the declaration for
creating an array of the format 2 x 3.