www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/CreateCategoricalArrayFromBinnedDataExample.m
%% Create Categorical Array by Binning Numeric Data % Use the |discretize| function (instead of |categorical|) to bin 100 % random numbers into three categories. % Copyright 2015 The MathWorks, Inc. x = rand(100,1); y = discretize(x,[0 .25 .75 1],'categorical',{'small','medium','large'}); summary(y)