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

    %% List Categories in Ordinal Categorical Array  

%% 
% Create an ordinal categorical array. 
A = categorical({'medium' 'large'; 'small' 'xlarge'; 'large' 'medium'},...
    {'small' 'medium' 'large' 'xlarge'},'Ordinal',true) 

%%
% |A| is a 3-by-2 ordinal categorical array.  

%% 
% Display the categories of |A|. 
C = categories(A) 

%%
% The categories appear in the order in which you specified them. Since
% |A| is ordinal, the categories have the mathematical ordering |small <
% medium < large < xlarge|.