%% Specify Categories Not Present in Input Array
% Convert the cell array of character vectors A to a categorical array. Specify a list of categories that includes values that are not present in A.
% Create a cell array of character vectors.

A = {'republican' 'democrat'; 'democrat' 'democrat'; 'democrat' 'republican'};

%
% Convert A to a categorical array. Add a category for independent.

valueset = {'democrat' 'republican' 'independent'};
B = categorical(A,valueset)

%
% Display the categories of B.

categories(B)

% Copyright 2012 The MathWorks, Inc.