%% Category Counts of Each Row in Categorical Array
% Create a 3-by-2 categorical array, A, from a numeric array.

A = categorical([1 3; 2 1; 3 1],1:3,{'red','green','blue'})

% A has three categories, red, green, and blue.
%
% Print a summary of A along the second dimension.

summary(A,2)

% red appears once in the first row of A, once in the second row, and once in the third row.
% green appears in only one element. It occurs in the second row of A.
% blue appears once in the first row of A and once in the third row.