%% Determine if Names Are Categories
% Create a categorical array, A.

A = categorical(["shirt","pants"; "pants","hat"; "shirt","pants"])

%
% The categories of A are names of articles of clothing. They come from the unique values of the input array.

categories(A)

%
% Determine if the names of articles of clothing, shirt, pants, socks, and shoes, are categories of A.

catnames = ["shirt","pants","socks","shoes"]
tf = iscategory(A,catnames)

% shirt and pants are categories of A, but socks and shoes are not.
% iscategory does not tell us anything about the category, hat, which we did not include in catnames.
% Copyright 2012-2021 The MathWorks, Inc.