numel - Maple Help

MTM

 numel
 number of elements in an array

 Calling Sequence numel(M) numel(M, i, j, ...)

Parameters

 M - array i, j - array indices

Description

 • The numel(M) function returns the number of elements in the array, M, or the number of elements in the subreference M[i,j].
 • numel does not perform bounds checking of the subreference index to assure that the index is valid.  Therefore, numel(M,5,5) will still return 1, the size of a subreference of the form M[5,5], even for a 2 x 2 array, M.
 • The special string, ":" can be used to denote the range of an entire dimension, for example, numel(M,":",1).  Or, ":" by itself as in numel(M,":") can be used to denote the whole array, which is equivalent to numel(M).

Examples

 > $\mathrm{with}\left(\mathrm{MTM}\right):$
 > $M≔\mathrm{Matrix}\left(2,3\right)$
 ${M}{≔}\left[\begin{array}{ccc}{0}& {0}& {0}\\ {0}& {0}& {0}\end{array}\right]$ (1)
 > $\mathrm{numel}\left(M\right)$
 ${6}$ (2)
 > $\mathrm{numel}\left(M,\left[1,2\right],2\right)$
 ${2}$ (3)
 > $\mathrm{numel}\left(M,1,":"\right)$
 ${3}$ (4)