FUNCTION REFERENCE

histc

Count values in bins given by edges.

Count values in bins given by edges.

Syntax

n = histc(x, edges)

Syntax

n = histc(x, edges, dim)

Syntax

[n, bin] = histc(x, edges)

n(k) counts x with edges(k) <= x < edges(k+1); n(end) counts x equal to

edges(end). bin gives the bin number of each element (0 if none). A vector

x gives a vector n of the same orientation. dim is 1 or 2.

Example

n = histc([1 2 2 3 5], [1 2 3 4 5])   % [1 2 1 0 1]

Differences from MATLAB: real 2-D input only; dim above 2 is an error.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.