MATBUILD

MATBUILD

Top  Previous  Next

 

The MATBUILD statement constructs a dynamic array from the elements of a matrix.

 

 

Format

 

MATBUILD var FROM mat {, start.expr {, end.expr} {USING delimiter}

 

where

 

varis the variable to receive the dynamic array.

 

matis the matrix from which data is to be taken.

 

start.exprevaluates to the index of the first matrix element to be used. If omitted or less than one, this defaults to one.

 

end.exprevaluates to the index of the last matrix element to be used. If omitted or less than one, this defaults to the number of elements in the matrix.

 

delimiterevaluates to the delimiter to be used between elements of mat. This may be more than one character. If omitted, this defaults to the field mark.

 

 

The MATBUILD statement behaves differently depending on the matrix style.

 

For a default style matrix, MATBUILD constructs a dynamic array by concatenating elements of mat in the range start.expr to end.expr, inserting delimiter between each element. If the zero element is null or unassigned, trailing null elements are ignored. If the zero element is not null, trailing null matrix elements are included and followed by a delimiter and the content of the zero element.

 

For a Pick style matrix, MATBUILD constructs a dynamic array by concatenating elements of mat in the range start.expr to end.expr, inserting delimiter between each element. Trailing null elements are ignored. Pick style matrices do not have a zero element. See the COMMON and DIMENSION statements for more details.

 

In either style, use of the INMAT() function immediately after MATBUILD will return the index value of the final element included. If the zero element of a default style matrix was non-null, INMAT() will return zero.

 

 

Example

 

MATBUILD REC FROM A USING @VM

 

This statement constructs dynamic array REC from the elements of matrix A, separating each element by a value mark.

 

 

See also:

MATPARSE