function nelements

Returns the number of elements in X. For a matrix, this is the total number of pixels, for a string, the number of characters, and for a stringarray, the number of strings.

Syntax
result = nelements(X)

Arguments
X:   A matrix, string, or string array.