This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Find undefined elements in categorical array




TF = isundefined(A) returns a logical array, TF, that indicates which elements in the categorical array, A, contain 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 values are similar to NaN in numeric arrays.


collapse all

Create a categorical array, A, 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 = 

     <undefined>      red         
     green            blue        
     green            red         
     blue             <undefined> 
     red              red         

A is a 5-by-2 categorical array with three categories: red, green, and blue. Array elements corresponding to the numeric value 4 in the input array to the categorical function do not have a corresponding category. Therefore, they are undefined in the output categorical array, A.

Find undefined elements in A.

TF = isundefined(A)
TF =

  5×2 logical array

   1   0
   0   0
   0   0
   0   1
   0   0

A(1,1) and A(4,2) are undefined.

Input Arguments

collapse all

Categorical array, specified as a vector, matrix, or multidimensional array.

More About

collapse all

Tall Array Support

This function fully supports tall arrays. For more information, see Tall Arrays.

See Also

Introduced in R2013b

Was this topic helpful?