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
xis a vector, thenhistcreturnsbincountsas a vector of histogram bin counts.If
xis a matrix, thenhistcoperates along each column ofxand returnsbincountsas 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
xlie outside the specified bin ranges, thenhistcdoes not include these values in the bin counts. Start and end thebinrangesvector with-infandinfto ensure that all values inxare included in the bin counts.
Extended Capabilities
Version History
Introduced before R2006a
See Also
bar | hist | mode | histogram | histcounts
