Matlab code to find the most repeatedly occuring highest value in the array.
이전 댓글 표시
Hi everybody I have the following list of numbers and I want to find the most repeatedly occuring highest value. I tried using mode but it gives ne the most repeatedly occuring lowest value. How can I get the most repeated highest value?
Also if my number is the format 4.566754E-11 or 3.9972378E-10 is there anyway I can make matlab ignore the E-11 oe E-10 tempüorarily and just round the value to one numver after decimal point?
eg: 4.566754E-11 --> 4.6E-11
I have attached in an excel sheet some values which I have in my matlan array for your reference.
Looking forward to your help.
댓글 수: 1
Jan
2015년 5월 17일
If I understand correctly: You are looking for the most frequent value in an array, and if there are several values appearing with the same frequency the highest value is wanted. Correct?
답변 (2개)
Image Analyst
2015년 5월 14일
You could try this:
a = [7 8 6 6 8 8 9 10 8 6 8 8 6 6 6]
[counts, edges] = histcounts(a)
modeIndexes = find(counts == max(counts))
greatestMode = ceil(edges(modeIndexes(end)))
You are looking for two different criteria: Most frequent and highest. This is simply impossible. You can find either the most frequent value, or the highest. Please give us a meaningful definition with a small example of what you want to achieve.
There are a lot of rounding function, simply search for "Matlab round significant digits". Should be digits be ignored for the calculations or for the display only?
댓글 수: 4
Snehalatha
2015년 5월 14일
편집: Snehalatha
2015년 5월 14일
Jan
2015년 5월 14일
Please post how you tried to apply the rounding.
Snehalatha
2015년 5월 17일
편집: Jan
2015년 5월 17일
Jan
2015년 5월 17일
mode() replies the most frequent value, so the multiplication by -1 is not a reliable method to prefer the higher values.
You have written: "I tried rounding but that just rounds my number to zero since the values I have are very small." Please post how you tried to round. Then we can suggest an improvement.
카테고리
도움말 센터 및 File Exchange에서 Variables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!