www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/NumberofElementsin3DMatrixExample.m

    %% Number of Elements in 3-D Matrix  

%% 
% Create a 4-by-4-by-2 matrix. 
A = magic(4);
A(:,:,2) = A'  

%% 
% |numel| counts 32 elements in the matrix. 
n = numel(A)