www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SummaryofCategoricalVectorExample.m
%% Summary of Categorical Vector %% % Create a 1-by-5 categorical vector. A = categorical({'plane' 'car' 'train' 'car' 'plane'}) %% % |A| has three categories, |car|, |plane|, and |train|. %% % Print a summary of |A|. summary(A) %% % |car| appears in two elements of |A|, |plane| appears in two elements, % and |train| appears in one element. %% % Since |A| is a row vector, |summary| lists the occurrences of each category % horizontally.