isundefined - Find undefined elements in categorical array - MATLAB (original) (raw)

Main Content

Find undefined elements in categorical array

Syntax

Description

TF = isundefined([A](#bt07o41-1-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 logical0 (false). The size ofTF 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 = 5×2 categorical red
green blue
green red
blue 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 = 5×2 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

expand all

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

Version History

Introduced in R2013b