www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/RemoveCategoriesandMakeCorrespondingValuesUndefinedExample.m
%% Remove Categories and Make Corresponding Values Undefined %% % Create a categorical array, |A|, containing modes of transportation. A = categorical({'plane' 'car'; 'train' 'car'; 'plane' 'car'}) %% % |A| is a 3-by-2 categorical array. %% % Display the categories of |A|. categories(A) %% % |A| has three categories, |car|, |plane|, and |train|. %% % Remove the category, |train|. B = removecats(A,'train') %% % The element that was from the category |train| is now undefined. %% % Display the categories of |B|. categories(B) %% % |B| has one fewer category than |A|.