%% Summary of Each Column in Categorical Array
% Create a 4-by-2 categorical array, A, from a numeric array.

X = [1 3; 2 1; 3 1; 4 2];
valueset = 1:3;
catnames = {'red','green','blue'};

A = categorical(X,valueset,catnames)

% A has three categories, red, green, and blue. The value, 4, was not included in the valueset input to the categorical function. Therefore, the corresponding element, A(4,1), does not have a corresponding category and is undefined.
%
% Print a summary of A.

summary(A)

% red appears once in the first column of A and twice in the second column.
% green appears once in the first column of A and once in the second column.
% blue appears once in the first column of A and once in the second column.
% A contains only one undefined element. It occurs in the first column.