How to get bin counts from max(histcount_plot)

4 次查看(过去 30 天)
I have a histcount plot which uses two different vectors. I called them 'Peak' and 'Bin'. The 'Bin' is obviously bins and 'Peak' is the data that goes in each bin. So then I made a histcount; Cnts=histcounts(Peak,Bin). Now I need a way to find the peak that this histcount will give. By peak, I mean finding the highest count and then find the corresponding bin number. I then need to plot those along with the histcount which I can do using the 'hold' command. I'm just having a problem with finding the Bin number that has the highest counts.

采纳的回答

Walter Roberson
Walter Roberson 2016-12-5
Use the two-output version of max() applied to Cnts. The second output gives you bin number and you can use it to index bins to get the location
  2 个评论
mohamed madani
mohamed madani 2016-12-6
How do you use the two-output version of max(). Is it something like 'max(Cnts,Bin)'?
mohamed madani
mohamed madani 2016-12-6
Nevermind, I figured it out. It works now. Thank you so much.

请先登录,再进行评论。

更多回答(1 个)

Jacob Ziesenis
Jacob Ziesenis 2016-12-5
I would try:
find(N==max(N))

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by