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

    %% Drop Levels From an Ordinal Array
%%
% Bin patient ages into ordinal levels corresponding to 10-year intervals.

% Copyright 2015 The MathWorks, Inc.

load hospital
edges = 0:10:100;
labels = strcat(num2str((0:10:90)','%d'),{'s'});
A = ordinal(hospital.Age,labels,[],edges);
getlabels(A)

%%
% Drop any levels that have no patients in them.
A = droplevels(A);
getlabels(A)