%% Mode of 3-D Array
% Create a 1-by-3-by-4 array of integers between 1 and 10.

rng('default')
A = randi(10,[1,3,4])

%
% Find the most frequent values of this 3-D array along the second dimension.

M = mode(A)

% This operation produces a 1-by-1-by-4 array by finding the most frequent value along the second dimension. The size of the second dimension reduces to 1.
%
% Compute the mode along the first dimension of A.

M = mode(A,1);
isequal(A,M)

% This returns the same array as A because the size of the first dimension is 1.
% Copyright 2012 The MathWorks, Inc.