www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/TestforCategoriesExample.m
%% Test for Categories %% % Create an ordinal categorical array, |A|. A = categorical({'shirt' 'pants'; 'pants' 'hat'; 'shirt' 'pants'}) %% % |A| is a 3-by-2 categorical array. %% % Test if the articles of clothing, |shirt|, |pants|, |socks|, and |shoes|, % are categories of |A|. catnames = {'shirt' 'pants' 'socks' 'shoes'}; tf = iscategory(A,catnames) %% % |shirt| and |pants| are categories of |A|, but |socks| and |shoes| are not. %% % |iscategory| does not tell us anything about the category, |hat|, which % we did not include in |catnames|.