Categorical Arrays - MATLAB & Simulink (original) (raw)

Main Content

Arrays of qualitative data with values from a finite set of discrete, nonnumeric data

categorical is a data type to store data with values from a finite set of discrete categories. For example, the syntax C = categorical({'R','G','B','B','G','B'}) creates a categorical array with six elements that belong to the categories R,G, or B.

A categorical array provides efficient storage and convenient manipulation of nonnumeric data, while also maintaining meaningful names for the data values. The categories can have a natural order, but it is not required. For more information see Create Categorical Arrays or watch Tables and Categorical Arrays.

Functions

expand all

categories List of categories in categorical array
iscategorical Determine if input is categorical array
iscategory Determine if inputs are names of categories
isordinal Determine if input is ordinal categorical array
isprotected Determine if categories of categorical array are protected
isundefined Find undefined elements in categorical array
addcats Add categories to categorical array
mergecats Merge categories in categorical array
removecats Remove categories from categorical array
renamecats Rename categories in categorical array
reordercats Reorder categories in categorical array
setcats Set categories in categorical array
combinations Generate all element combinations of arrays (Since R2023a)
summary Data summary
countcats Count occurrences of categorical array elements by category

Topics