Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Assigns values to all the elements in a dimensioned array.
MAT array = value

MAT array1 = MAT array2
array Name of an existing array. This array must have been dimensioned using the DIM statement.
value The value to assign to all of the elements of the array. An expression that resolves to a value.
The MAT statement assigns values to all of the elements of a specified array. This array may be one-dimensional or two-dimensional. MAT has two forms:
This statement cannot be executed from the MVBasic command shell. Attempting to do so results in a MVBasic syntax error.
D3 supports array1 = MAT array2 as functionally equivalent to MAT array1 = MAT array2.
The following examples illustrate the use of the MAT statement:
! Dimension a one-dimensional array with 6 elements.
DIM MyVector1(6)
! Dimension a one-dimensional array with 10 elements.
DIM MyVector2(10)
! Assign the value "pending" to all elements of MyVector2
MAT MyVector2="pending"
! Assign the values of elements of one array to another array
MAT MyVector1=MAT MyVector2
! Results are a that MyVector1 contains 6 elements all assigned
! the value "pending"
See Also