MultiDimensional Arrays

Cypress Enable supports multidimensional arrays. For example the following example declares a two-dimensional array within a procedure.

Static Mat(20, 20) As Double

Either or both dimensions can be declared with explicit lower bounds.

Static Mat(1 to 10, 1 to 10) As Double

You can efficiently process a multidimensional array with the use of for loops. In the following statements the elements in a multidimensional array are set to a value.

Dim L As Integer, J As Integer

Static TestArray(1 To 10, 1 to 10) As Double

For L = 1 to 10

For J = 1 to 10

TestArray(L,J) = I * 10 + J

Next J

Next L

Arrays can be more than two dimensional. Enable does not have an arbitrary upper bound on array dimensions.

Dim ArrTest(5, 3, 2)

This declaration creates an array that has three dimensions with sizes 6 by 4, by 3 unless Option Base 1 is set previously in the code. The use of Option Base 1 sets the lower bound of all arrays to 1 instead of 0.