Documentation Center

  • Trial Software
  • Product Updates


Class: categorical

Test for undefined elements

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.


I = isundefined(A)


I = isundefined(A) returns a logical array I the same size as the categorical array A. I is true (1) where the corresponding element of A is not assigned to any level. I is false (0) where the corresponding element of A is assigned to a level.


Create and display undefined levels in an ordinal array:

A = ordinal([1 2 3 2 1],{'lo','med','hi'})
A = 
     lo      med      hi      med      lo

A = droplevels(A,{'med','hi'})
Warning: OLDLEVELS contains categorical levels that
were present in A, caused some array elements to
have undefined levels.
A =
     lo  <undefined>  <undefined>  <undefined>  lo

I = isundefined(A)
I =
     0     1     1     1     0

See Also


Was this topic helpful?