numel
Total number of elements.
Syntax
Section titled “Syntax”n = numel(A)Description
Section titled “Description”Returns the total element count of A — the product of all dimension sizes. Equivalent to prod(size(A)). For an empty array, returns 0.
The MATLAB-compatible indexed form numel(A, idx1, idx2, ...) is reserved but currently raises a runtime error.
Examples
Section titled “Examples”numel([1 2 3 4]) % 4numel(zeros(3,5)) % 15numel([]) % 0