INMAT()

Top  Previous  Next

 

The INMAT() function provides qualifying information after certain statements are executed.

 

 

Format

 

INMAT({mat})

 

where

 

matis the name of a matrix.

 

 

Used without a mat matrix name, the INMAT() function returns information relating to the last use of the following statements

 

DIMENSION0 if successful, 1 if insufficient memory.
MATPARSEThe number of elements assigned. Zero if overflows.
MATREADThe number of elements assigned. Zero if overflows.
MATREADLThe number of elements assigned. Zero if overflows.
MATREADUThe number of elements assigned. Zero if overflows.
OPENThe modulus of a dynamic file.

 

Further details of the information returned by INMAT() in each case is documented with the relevant statement.

 

Used with a matrix name, the INMAT() function returns the current dimensions of the matrix. If mat is a single dimensional matrix, INMAT() returns the number of elements, excluding the zero element. If mat is a two dimensional matrix, INMAT() returns the number of rows and columns as two values separated by a value mark.

 

 

Examples

 

DIM A(N)

IF INMAT() THEN ABORT "Insufficient memory"

 

This program fragment dimensions matrix A and tests whether it was successful. If not, the program aborts.

 

 

N = INMAT(A)

FOR I = 1 TO N

  A(I) += 1

NEXT I

 

This program fragment adds one to each element of matrix A. The INMAT() function is used because the matrix was dimension elsewhere and hence its size is not known.