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

A = gallery('integerdata',10,[1,3,4],1)

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

M = median(A)

% This operation produces a 1-by-1-by-4 array by computing the median of the three values along the second dimension. The size of the second dimension is reduced to 1.
%
% Compute the median along the first dimension of A.

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

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