Documentation Center

  • Trial Software
  • Product Updates


Class: categorical

Convert categorical array to unsigned 8-bit integers

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.


B = uint8(A)


B = uint8(A) converts the categorical array A to unsigned 8-bit integers. Each element of B contains the internal categorical level code for the corresponding element of A. Undefined elements of A are assigned the value 0 in B. If A contains more than intmax('uint8') levels, the internal codes will saturate to intmax('uint8')when cast to int8.

See Also


Was this topic helpful?