categorical.iscategory
categorical: TF = iscategory (C, catnames)
Test for categories in a categorical array.
TF = iscategory (C, catnames) returns a logical
array TF of the same size as catnames containing true
for each corresponding element of catnames that is a category in
categorical array C and false otherwise.
Source Code: categorical
iscategory tests whether names are categories of the array — independently of whether any element currently takes those values.
C = categorical ({'M'; 'S'}, {'S', 'M', 'L'})
C =
2x1 categorical array
M
S
iscategory (C, {'M', 'L', 'XL'})
ans = 1 1 0
M and L are declared categories; XL is not.