Matlab code to find the most repeatedly occuring highest value in the array.
4 ビュー (過去 30 日間)
古いコメントを表示
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)))
0 件のコメント
Jan
2015 年 5 月 13 日
編集済み: Jan
2015 年 5 月 13 日
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 件のコメント
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.
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!