From: Jim O'Doherty on
Hi matlab-ers,
I've got an array of X and an array of Y position data.
Can anyone tell me how I might determine how often each pair of X,Y values occur? I was thinking along the lines of the hist() command but over 2 arrays but hit a wall.
Thanks,
Jim
From: Bruno Luong on
"Jim O'Doherty" <jim.odoherty(a)gmail.com> wrote in message <i2772s$2da$1(a)fred.mathworks.com>...
> Hi matlab-ers,
> I've got an array of X and an array of Y position data.
> Can anyone tell me how I might determine how often each pair of X,Y values occur? I was thinking along the lines of the hist() command but over 2 arrays but hit a wall.
> Thanks,
> Jim

This FEX submission might be of your interest:
http://www.mathworks.com/matlabcentral/fileexchange/23897-n-dimensional-histogram

Bruno
From: Walter Roberson on
Jim O'Doherty wrote:

> I've got an array of X and an array of Y position data. Can anyone tell
> me how I might determine how often each pair of X,Y values occur? I was
> thinking along the lines of the hist() command but over 2 arrays but hit
> a wall.

As I recall the Matlab File Exchange has several multi-dimensional
histogram routines.

I think I've even posted roughed out code for one myself earlier this
year, but the ones in FEX have been tested.
From: Jim O'Doherty on
Thanks for the point in the right direction Bruno. Does my data need to be sorted? My X, Y arrays are electron positions so they are not in any increasing/decreasing order. I seem to be getting an error saying it requires monotonically decreasing arrays
Thanks,
Jim

"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <i277ng$dhv$1(a)fred.mathworks.com>...
> "Jim O'Doherty" <jim.odoherty(a)gmail.com> wrote in message <i2772s$2da$1(a)fred.mathworks.com>...
> > Hi matlab-ers,
> > I've got an array of X and an array of Y position data.
> > Can anyone tell me how I might determine how often each pair of X,Y values occur? I was thinking along the lines of the hist() command but over 2 arrays but hit a wall.
> > Thanks,
> > Jim
>
> This FEX submission might be of your interest:
> http://www.mathworks.com/matlabcentral/fileexchange/23897-n-dimensional-histogram
>
> Bruno
From: Bruno Luong on
"Jim O'Doherty" <jim.odoherty(a)gmail.com> wrote in message <i27lak$l0q$1(a)fred.mathworks.com>...
> Thanks for the point in the right direction Bruno. Does my data need to be sorted? My X, Y arrays are electron positions so they are not in any increasing/decreasing order. I seem to be getting an error saying it requires monotonically decreasing arrays
> Thanks,
> Jim

Assuming you deal only with single but unsorted X, how did you intend to use HISTC to count? Probably you have to build a sorted edge from X, e.g. with UNIQUE.

The same approach works with (X,Y).

Bruno
 |  Next  |  Last
Pages: 1 2
Prev: convert arcgis grid to geotiff
Next: LVQ