%% Determine if categorical Array Is Ordinal
% Create a categorical array containing the sizes of 10 objects. Use the names small, medium, and large for the values 'S', 'M', and 'L'.

A = categorical({'M';'L';'S';'S';'M';'L';'M';'L';'M';'S'},...
    {'S','M','L'},{'small','medium','large'})

%
% Determine if the categories of A have a mathematical ordering.

isordinal(A)

% A is not ordinal. You must use the 'Ordinal',true name-value argument in the function categorical to create an ordinal categorical array.
% Copyright 2012-2021 The MathWorks, Inc.