Returns the number ofelements contained in any expression or variable.
Scalar expressions always have one element. The number of elements in an array is equal to the product of its dimensions. If expr is an undefined variable, N_ELEMENTS will return zero.
a = INDGEN(3, 2)
PRINT, a
0 1 2
3 4 5
PRINT, N_ELEMENTS(a)
6
a
.
DELVAR, a
a
.
INFO, a
VARIABLE UNDEFINED = Undefined
PRINT, N_ELEMENTS(a)
0