www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SetNewCategoriesExample.m

    %% Set New Categories
% Create a categorical array containing various colors.

% Copyright 2015 The MathWorks, Inc.


A = categorical({'blue','black','red';'red','blue','black';'black','red','blue'})
%% 
% Set new categories.

B = setcats(A,{'red','black'})
%% 
% Elements that were |blue| in |A| are undefined in |B|.