Determining quantities of different integers in a large data set
Mostra commenti meno recenti
I am currently working with a large data set, specifically 500 integers. The values are randomly generated between two specified values, x1 and x2. There is not a large range between x1 and x2 and therefore the same values are repeated a number of times. What I am trying to do is to come up with a way of determining how often each integer is repeated.
To clarify, assuming x1 = 5 and x2 = 10 and 500 integers are randomly generated between these values. Within the randomly generated integers, how many 5's were generated, how many 6, how many 7, etc etc.
I am attempting to find the quickest way of doing this without having lines and lines of code.
3 Commenti
David Goodmanson
il 25 Nov 2017
Hello A^2
The histcounts function will probably get the job done. It lets you set bin edges and/or widths, and you might have to experiment around a little to get the result you want.
Image Analyst
il 25 Nov 2017
Modificato: Image Analyst
il 25 Nov 2017
David, put this in the Answers section so you might get credit for it. histogram() is also a related function. By the way, it's funny how he thinks 500 elements is "large".
Anonymous Anonymous
il 25 Nov 2017
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!