Categories &

Functions List

Class Definition: categorical

datatypes: categorical

Array representing categorical data.

A categorical array represents an array of values that correspond to a finite set of discrete categories, which can be either ordinal (having a mathematical ordering) or nominal. It is an efficient way to define groups of rows in a table or to other types of variables.

Each categorical array stores the list of categories as a cell array of character vectors and a numeric array of uint16 type as indices to the categories. The categorical array may also store elements of undefined categorical values, which represent the absence of a given category and correspond to the NaN value for numeric arrays or in general to the missing value for other data types.

categorical arrays do not have any public properties, which can be indexed by using dot notation similarly to structures. However, there are several methods which can be used to modify their categories once they are constructed.

Source Code: categorical

The categorical class offers the following public methods:

categorical Create a new array of categorical values.
dispstrings Get display formatted strings for each element of a categorical array.
cellstr Convert categorical array to a cell array of character vectors.
char Convert categorical array to a 2-D character matrix.
double Convert categorical array to a double array.
single Convert categorical array to a single array.
int64 Convert categorical array to a int64 array.
int32 Convert categorical array to a int32 array.
int16 Convert categorical array to a int16 array.
int8 Convert categorical array to a int8 array.
uint64 Convert categorical array to a uint64 array.
uint32 Convert categorical array to a uint32 array.
uint16 Convert categorical array to a uint16 array.
uint8 Convert categorical array to a int8 array.
summary Display summary of categorical array.
categories List of categories in categorical array.
countcats Count occurrences of categories in a categorical array.
length Length of a categorical vector.
size Size of a categorical array.
ndims Number of dimensions in a categorical array.
numel Total number of elements in a categorical array.
keyHash Generate a hash code for a categorical array.
iscategory Test for categories in a categorical array.
iscolumn Return true if categorical array is a column vector.
isempty Return true if categorical array is empty.
isequal Return true if categorical arrays are equal.
isequaln Return true if categorical arrays are equal under the assumption that undefined elements are equal.
ismatrix Return true if categorical array is a 2-D array.
ismember Find categorical elements in a set.
ismissing Find missing elements in categorical array.
isordinal Test if categorical array is ordinal.
isprotected Test if categorical array is protected.
isrow Return true if categorical array is a row vector.
isscalar Return true if categorical array is a scalar.
issorted Return true if categorical array is sorted.
issortedrows Return true if categorical matrix rows are sorted.
isundefined Test for undefined elements in categorical array.
isvector Return true if categorical array is a vector.
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.
times Combine categorical arrays.
eq Equality for categorical arrays.
ge Greater than or equal to for ordinal categorical arrays.
gt Greater than for ordinal categorical arrays.
le Less than or equal to for ordinal categorical arrays.
lt Less than for ordinal categorical arrays.
ne Not equal for categorical arrays.
min Smallest elements in ordinal categorical arrays.
max Largest elements in ordinal categorical arrays.
median Median value of an ordinal categorical array.
mode Most frequent element in a categorical array.
histcounts Histogram bin counts of a categorical array.
sort Sort elements in a categorical array.
sortrows Sort rows in a categorical array.
topkrows Top K sorted rows of categorical array.
unique Unique values in a categorical array.
intersect Set intersection of two categorical arrays.
setdiff Set difference of two categorical arrays.
setxor Set exclusive-or of two categorical arrays.
union Set union of two categorical arrays.
cat Concatenate categorical arrays.
horzcat Horizontal concatenation of categorical arrays.
vertcat Vertical concatenation of categorical arrays.
repmat Repeat copies of a categorical array.
repelem Repeat copies of categorical array elements.
repelems Construct a vector of repeated elements from a categorical array.
reshape Repeat copies of categorical array elements.
circshift Circularly shift the elements in a categorical array.
permute Generalized transpose for a categorical N-D array.
ipermute Inverse of the generalized transpose for a categorical N-D array.
transpose Transpose a categorical matrix.
ctranspose Transpose a categorical matrix.