Navigation

Operators and Keywords

Function List:

C++ API

: n = histc (x, edges)
: n = histc (x, edges, dim)
: [n, idx] = histc (…)

Compute histogram counts.

When x is a vector, the function counts the number of elements of x that fall in the histogram bins defined by edges. This must be a vector of monotonically increasing values that define the edges of the histogram bins. n(k) contains the number of elements in x for which edges(k) <= x < edges(k+1). The final element of n contains the number of elements of x exactly equal to the last element of edges.

When x is an N-dimensional array, the computation is carried out along dimension dim. If not specified dim defaults to the first non-singleton dimension.

When a second output argument is requested an index matrix is also returned. The idx matrix has the same size as x. Each element of idx contains the index of the histogram bin in which the corresponding element of x was counted.

See also: hist.

Package: octave