Documentation Center

  • Trial Software
  • Product Updates

categorical class

Arrays for categorical data

The nominal and ordinal array data types might be removed in a future release. To represent ordered and unordered discrete, nonnumeric data, use the MATLAB® categorical data type instead.


In Statistics Toolbox™, categorical is an abstract class, and you cannot create instances of it directly. You must create nominal or ordinal arrays. For the MATLAB categorical data type, see categorical.

Categorical arrays store data with values in a discrete set of levels. Each level is meant to capture a single, defining characteristic of an observation. If you do not encode ordering in the levels, the data and the array are nominal. If you do encode an ordering, the data and the array are ordinal.


addlevelsAdd levels to categorical array
catConcatenate categorical arrays
cellstrConvert categorical array to cell array of strings
charConvert categorical array to character array
circshiftShift categorical array circularly
ctransposeTranspose categorical matrix
dispDisplay categorical array
displayDisplay categorical array
doubleConvert categorical array to double array
droplevelsDrop levels
endLast index in indexing expression for categorical array
flipdimFlip categorical array along specified dimension
fliplrFlip categorical matrix in left/right direction
flipudFlip categorical matrix in up/down direction
getlabelsAccess categorical array labels
getlevelsGet categorical array levels
histPlot histogram of categorical data
horzcatHorizontal concatenation for categorical arrays
int16Convert categorical array to signed 16-bit integer array
int32Convert categorical array to signed 32-bit integer array
int64Convert categorical array to signed 64-bit integer array
int8Convert categorical array to signed 8-bit integer array
intersectSet intersection for categorical arrays
ipermuteInverse permute dimensions of categorical array
isemptyTrue for empty categorical array
isequalTrue if categorical arrays are equal
islevelTest for levels
ismemberTrue for elements of categorical array in set
isscalarTrue if categorical array is scalar
isundefinedTest for undefined elements
isvectorTrue if categorical array is vector
lengthLength of categorical array
levelcountsElement counts by level
mergelevelsMerge levels
ndimsNumber of dimensions of categorical array
numelNumber of elements in categorical array
permutePermute dimensions of categorical array
reorderlevelsReorder levels
repmatReplicate and tile categorical array
reshapeResize categorical array
rot90Rotate categorical matrix 90 degrees
setdiffSet difference for categorical arrays
setlabelsLabel levels
setxorSet exclusive-or for categorical arrays
shiftdimShift dimensions of categorical array
singleConvert categorical array to single array
sizeSize of categorical array
squeezeSqueeze singleton dimensions from categorical array
subsasgnSubscripted assignment for categorical array
subsindexSubscript index for categorical array
subsrefSubscripted reference for categorical array
timesProduct of categorical arrays
transposeTranspose categorical matrix
uint16Convert categorical array to unsigned 16-bit integers
uint32Convert categorical array to unsigned 32-bit integers
uint64Convert categorical array to unsigned 64-bit integers
uint8Convert categorical array to unsigned 8-bit integers
unionSet union for categorical arrays
uniqueUnique values in categorical array
vertcatVertical concatenation for categorical arrays


labelsText labels for levels
undeflabelText label for undefined levels

Copy Semantics

Value. To learn how this affects your use of the class, see Comparing Handle and Value Classes in the MATLAB Object-Oriented Programming documentation.

How To

Was this topic helpful?