FUNCTION REFERENCE
discretize
Bin indices of data.
Bin indices of data.
Syntax
Y = discretize(X, edges)Syntax
Y = discretize(X, edges, values)Syntax
Y = discretize(X, edges, 'IncludedEdge', side)Syntax
[Y, E] = discretize(...)Y has the size of X and holds the bin of each element: bin i is
[edges(i), edges(i+1)), and the last bin also holds edges(end). With
'IncludedEdge', 'right' bin i is (edges(i), edges(i+1)] and the first bin
also holds edges(1). Values outside the edges, and NaN, give NaN. values
replaces bin i by values(i). E returns the edges.
Example
discretize([1 2.5 3 4 7], [1 3 5]) % [1 1 2 2 NaN]Differences from MATLAB: a number of bins instead of edges, and
'categorical', are not supported yet.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.