%% Categorical Array with Undefined Values
% 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 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)

% A(1,1) and A(4,2) are undefined.
% Copyright 2012 The MathWorks, Inc.