Main Content

isundefined

Find undefined elements in categorical array

Description

TF = isundefined(A) returns a logical array that indicates which elements in a categorical array are undefined values. isundefined returns logical 1 (true) for undefined elements; otherwise it returns logical 0 (false). The size of TF is the same as the size of A.

Any elements in A without a corresponding category are undefined. Undefined categorical values are missing values, similar to NaNs, NaTs, and missing strings for other data types.

example

Examples

collapse all

Create a categorical array from numeric values where 1, 2, and 3 represent red, green, and blue respectively.

A = categorical([4 1; 2 3; 2 1; 3 4; 1 1],1:3,["red" "green" "blue"])
A = 5x2 categorical
     <undefined>      red         
     green            blue        
     green            red         
     blue             <undefined> 
     red              red         

Array elements corresponding to the numeric value 4 in the input array do not have a corresponding category. Therefore, they are undefined in the output categorical array.

Find undefined elements in the categorical array.

TF = isundefined(A)
TF = 5x2 logical array

   1   0
   0   0
   0   0
   0   1
   0   0

Input Arguments

collapse all

Input array, specified as a categorical array.

Extended Capabilities

Version History

Introduced in R2013b