Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

Determining the Number of Array Elements in an Expression or Variable


The N_ELEMENTS function returns the number of elements contained in any expression or variable. Scalars always have one element. The number of elements in arrays or vectors is equal to the product of the dimensions. The N_ELEMENTS function returns zero if its parameter is an undefined variable. The result is always a longword scalar.

For example, the following expression is equal to the mean of a numeric vector or array.

TOTAL(arr) / N_ELEMENTS(arr) 

Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]