histc
(Not recommended) Histogram bin counts
histc
is not recommended. Use histcounts
instead.
For more information, including suggestions on updating code, see Replace Discouraged Instances of hist and histc.
Description
counts the number of values in bincounts
= histc(x
,binranges
)x
that are within each specified bin range.
The input, binranges
, determines the endpoints for each bin. The output,
bincounts
, contains the number of elements from x
in each
bin.
If
x
is a vector, thenhistc
returnsbincounts
as a vector of histogram bin counts.If
x
is a matrix, thenhistc
operates along each column ofx
and returnsbincounts
as a matrix of histogram bin counts for each column.
To plot the histogram, use bar(binranges,bincounts,'histc')
.
Examples
Input Arguments
Output Arguments
Tips
If values in
x
lie outside the specified bin ranges, thenhistc
does not include these values in the bin counts. Start and end thebinranges
vector with-inf
andinf
to ensure that all values inx
are included in the bin counts.
Extended Capabilities
Version History
Introduced before R2006a
See Also
bar
| hist
| mode
| histogram
| histcounts