histcΒΆ

histc calculates a histogram.

r = histc(v, edges)

Return Value

r is a vector of length len(e)-1. Each element contains the number of points that fall between the elements in the edges vector (v[i] >= edges[j] and v[i] < edges[j+1]). The last bin counts any values of v that match edges(end). Values outside the values in edges are not counted. In case of an error the function returns -1.

Parameters

v

v is a real vector or matrix.

edges

edges is a vector with bin edges. The vector must have at least two elements. The elements must be sorted monotone increasing (edges[i] < edges[i+1]).

Example

* a = [1, 1.2, 1.41, 1.65, 1.66, 1.71, 1.8, 2.0]
* edges = [1, 1.2, 1.4, 1.6, 1.8, 2.0]
* histc(a, edges)
1
1
1
3
2

Histogram of a bitmap:

hImg = ImageCreate("c:/test.png");
b = ImageUpdate(hImg);
if (b == FALSE) error("image not found");
g = ImageGetPixelGray(hImg);
r = histc(g, 0:255);
plot(r);

History

Version Description
5.3.2 New.

id-926486