Categorical Arrays
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
Topics
- Create Categorical Arrays
Create categorical arrays from various types of input data and modify their elements.
- Access Data Using Categorical Arrays
Search, select, and delete elements from categorical arrays.
- Advantages of Using Categorical Arrays
Categorical arrays provide a natural representation of data, mathematical ordering of character vectors, and efficient memory usage.
- Core Functions Supporting Categorical Arrays
Many functions in MATLAB® operate on categorical arrays in much the same way that they operate on other arrays. A few of these functions might exhibit special behavior when operating on a categorical array.