%% Mode of Matrix Columns with Frequency Information
% Define a 3-by-4 matrix.

A = [3 3 1 4; 0 0 1 1; 0 1 2 4]

%
% Find the most frequent value of each column, as well as how often it occurs.

[M,F] = mode(A)

% F(1) is 2 since M(1) occurs twice in the first column.
% Copyright 2012 The MathWorks, Inc.