iscategory
Tests which names are categories of a categorical array.
Category: Language Fundamentals > Data Types
Syntax
tf = iscategory(C, names)
Returns true for each name in names that is a category of C.
Description
The test concerns the set of categories, not the data. A category can exist without any element currently having that value, and then iscategory is still true.
Input arguments
Ccategoricalarray.names- Text or cell array of text with the category names to look for.
Output arguments
tf- Logical array, one entry per name.
Example
Looking up categories
C = categorical({'a', 'b', 'a'});
iscategory(C, 'a')
iscategory(C, {'a', 'z'})
Output
ans = logical
1
ans = 1×2 logical array
1 0