FUNCTION REFERENCE
histcounts
Count values in bins.
Count values in bins.
Syntax
N = histcounts(X)Syntax
N = histcounts(X, nbins)Syntax
N = histcounts(X, edges)Syntax
[N, edges] = histcounts(X, ...)Bins are [edges(k), edges(k+1)) and the last bin is closed. NaN values are
ignored. Bins are equal width at "nice" positions, as in MATLAB: integer data
spanning at most 50 gets one bin per integer, other data Scott's rule. N is a
row.
Example
[N, edges] = histcounts([1 2 2 3 5 7], 3) % N = [3 2 1], edges = [0 3 6 9]Syntax
[N, edges] = histcounts(X, ..., Name, Value)Options: NumBins, BinEdges, BinWidth, BinLimits, BinMethod (auto, scott, fd,
integers, sturges, sqrt) and Normalization (count, probability, pdf, cdf,
countdensity, cumcount), with the same rules as histogram.
Example
histcounts([1 2 2 4], 'BinLimits', [0 4], 'NumBins', 2, 'Normalization', 'probability') % [0.25 0.75]Differences from MATLAB: the third output (bin indices) is not returned.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.