categorical

Methods

Method Reference: categorical.isundefined

categorical: out = isundefined (C)

Test for undefined elements in categorical array.

TF = isundefined (C) returns a logical array TF of the same size as C containing true for each corresponding element of C that does not have a value from one of the categories in C and false otherwise. <undefined> is the equivalent of NaN in numeric arrays.

Source Code: categorical

Example: 1

isundefined flags the elements that belong to no category — the <undefined> values that stand in for missing data. Empty labels become undefined at construction time.

 C = categorical ({'M'; ''; 'L'; 'M'})
C =
  4x1 categorical array

    M              
    <undefined>    
    L              
    M
 isundefined (C)
ans =

  0
  1
  0
  0

Dropping a category also undefines every element that used it.

 isundefined (removecats (C, 'M'))
ans =

  1
  1
  0
  1