how to know the number of elements in array code example Example: Number of array elements A = magic(4); A(:,:,2) = A' n = numel(A)