MAT |
![]() ![]() ![]() |
The MAT statement assigns a value to all elements of a matrix or copies one matrix to another.
Format
MAT matrix = expr MAT matrix = MAT src.matrix
where
The first format of this statement copies the value of expr into all elements of matrix. The zero element is set to a null string.
The second format copies elements from src.matrix to matrix row by row. If the number of columns differs, the copy behaves as depicted below.
The zero element of src.matrix is copied to the zero element of matrix.
If src.matrix has more elements than matrix, the excess elements are ignored. If src.matrix has fewer elements than matrix, the remaining elements of matrix are unchanged.
A single dimensional matrix can be copied to a two dimensional matrix and vice versa.
Examples
DIM A(25) MAT A = 0
This program fragment dimensions matrix A to have 25 elements and sets them all to zero.
DIM A(5,5), B(25) ... statements that set values in matrix A... MAT B = MAT A
This program fragment dimensions two matrices, sets values into matrix A and then creates a single dimensional copy of A in matrix B. |