Main Content

Categorical Arrays

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.


expand all

categoricalArray that contains values assigned to categories
discretizeGroup data into bins or categories
categoriesList of categories in categorical array
iscategoricalDetermine whether input is categorical array
iscategoryDetermine if inputs are names of categories
isordinalDetermine whether input is ordinal categorical array
isprotectedDetermine whether categories of categorical array are protected
isundefinedFind undefined elements in categorical array
addcatsAdd categories to categorical array
mergecatsMerge categories in categorical array
removecatsRemove categories from categorical array
renamecatsRename categories in categorical array
reordercatsReorder categories in categorical array
setcatsSet categories in categorical array
summaryPrint summary of table, timetable, or categorical array
countcatsCount occurrences of categorical array elements by category