# Find the membership value of a given point on a 3D histogram grid?

I use 2D dataset like below,

``````37.0235000000000    18.4548000000000
28.4454000000000    15.7814000000000
34.6958000000000    20.9239000000000
26.0374000000000    17.1070000000000
27.1619000000000    17.6757000000000
28.4101000000000    15.9183000000000
33.7340000000000    17.1615000000000
34.7948000000000    18.2695000000000
34.5622000000000    19.3793000000000
36.2884000000000    18.4551000000000
26.1695000000000    16.8195000000000
26.2090000000000    14.2081000000000
26.0264000000000    21.8923000000000
35.8194000000000    18.4811000000000
```
```

to create a 3D histogram.

How can I find the histogram value of a point on a grid? For example, if `[34.7948000000000 18.2695000000000]` point is given, I would like to find the corresponding value of a histogram for a given point on the grid.

I used this code

``````point = feat_vec(i,:); // take the point given by the data set
X = centers{1}(1,:); // take center of the bins at one dimension
Y = centers{2}(1,:); // take center of the bins at other dim.

distanceX = abs(X-point(1)); // find distance to all bin centers at one dimension
distanceY = abs(Y-point(2)); // find distance to center points of other dimension

[~,indexX] = min(distanceX); // find the index of minimum distant center point
[~,indexY] = min(distanceY); // find the index of minimum distant center point for other dimension
```
```