Skip to main content
Previous section   Next section

INMAT

Returns the number of array elements.

Synopsis

INMAT(array)

Arguments

array Optional — The name of a dimensioned array; must be a literal name, not enclosed with quotes. If omitted, the most recently parsed dimensioned array.

Description

The INMAT function has two uses:

  • INMAT(array) returns the defined dimensions of the named array.

  • INMAT() returns the number of elements loaded into the most recently parsed array.

Before invoking INMAT, an array must have been dimensioned using the DIM (or DIMENSION) statement.

INMAT(array) takes the name of a dimensioned array and returns a two-element dynamic array containing the rows and columns dimensions of the array. If the DIM did not specify a columns dimension, INMAT returns 1 as the columns dimension.

Specifying an array value that is not a dimensioned array results in a #1039 compile error. The array must be an explicitly dimensioned static array. Specifying an implicitly dimensioned (dynamic) array results in a runtime <ARRAY DIMENSION> error.

INMAT() defaults to the most recently loaded array. It returns an integer specifying the number of elements that were loaded using a MATREAD, MATREADU, or MATPARSE statement. If no array has been loaded, or the most recently loaded array was loaded with the null string or with a single element, INMAT() returns 1.

Examples

The following example returns the row and column dimensions of a dimensioned array:

DIM MyArray(6,5)
CRT INMAT(MyArray)
    ! Returns 6ý5
Copy code to clipboard

The following example returns the number of dimensioned array elements parsed by MATPARSE:

DIM MyArray(6,5)
x="Fred":@FM:"Barney":@FM:"Wilma"
MATPARSE MyArray FROM x
CRT INMAT()
    ! Returns 3
Copy code to clipboard

See Also