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

    %% Include Right Edge of Each Bin
% Use the |'IncludedEdge'| input to specify that each bin includes its
% right bin edge. The first bin includes both edges. Compare the result to
% the default inclusion of left bin edges.
X = 1:2:11;
edges = [1 3 4 7 10 11];
Y = discretize(X,edges,'IncludedEdge','right')

%%
Z = discretize(X,edges)