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

    %% Create New Category From Merged Levels
%%
% Create a nominal array from data in a cell array.
colors = nominal({'r','b','g';'g','r','b';'b','r','g'},...
                 {'blue','green','red'})
             
%%
% Merge the elements of the |'red'| and |'blue'| levels into a new
% level labeled |'purple'|.
colors = mergelevels(colors,{'red','blue'},'purple')

%%
% Display the levels of |colors|.
getlevels(colors)