1
votes

In my application, I have a number of data points and each are associated with a number and strength. I am trying to figure out how to sort these data points so that I can find the most frequent data point with the highest strength -- the answer will be sort of like an average between these two.

I can use hist() to generate the histogram of the data points and find which number occurs most often. However, I'm having trouble thinking of a way to sort the data point strengths by number easily. (I figure I can just multiply the hist of numbers with hist of strengths to find the best bin.) I don't think hist() can do this. Is there another way? Or am I limited to just binning the data point strengths manually by going through each number of bin?

1
FWIW I had the same question a long time ago, searched in vain for the function you are looking for, and ended up writing my own. - Matt Phillips
I don't think there is a simple function for this but if you could share some sample data I would be willing to give it a shot. - Stefan Gretar
As you mentioned in the question, you should start by defining the meaning of sort. I suggest looking into approaches of sorting quantities containing several variables. Once you pick one that makes sense in you're case, you're 90% done. - Phonon
I've read this a few times. I feel simultaneously that it should be easy (using hist, histc, sort etc) and that it is something more profound and difficult ... by which I mean that I don't really understand it. A little bit of sample data would really help, even a trivial set of 5 or 6 data points plus the trivial result. - Pursuit

1 Answers

0
votes

I may be severely misinterpreting your problem, but why don't you use a 2D histogram routine (there are many in the FEX, such as this) and find the bin - corresponding to a range of numbers and a range of strengths - with the highest incidence of data points?