Determining quantities of different integers in a large data set
이전 댓글 표시
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
David Goodmanson
2017년 11월 25일
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
2017년 11월 25일
편집: Image Analyst
2017년 11월 25일
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
2017년 11월 25일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!