VLEN

Syntax: vector = VLEN(vector)
vector = VLEN(matrix)

The VLEN function accepts either a vector or a matrix as argument. It returns the length of each dimension of the argument. If the argument is a vector, the result is a vector of length one (1). If the argument is a matrix, the result is a vector of length two (2), with the first element being the number of rows and the second the number of columns.

Examples

Suppose X is a vector of length 10 and M is a matrix with 5 rows and 12 columns.

  A = VLEN(X)      ! number of elements of vector X
  B = VLEN(M)
  NR = VLEN(M)[1]  ! number of rows of matrix M
  NC = VLEN(M)[2]  ! number of columns of matrix M
 

makes vectors A and B with A = {10} and B = {5;12} and scalars NR and NC. Note that A is a vector of length one (1).

  LEN
  CLEN