简体   繁体   English

如何重现MATLAB`hist`函数的结果

[英]How to reproduce result of MATLAB `hist` function

I have a MATLAB function that has this line code: 我有一个具有以下行代码的MATLAB函数:

  hist(h.axesHistIBI,ibi(:,2),nBins); %plot       

This line plots a histogram. 这条线绘制直方图。 Where h.axesHistIbi is: 其中h.axesHistIbi是:

<code> h.axesHistIBI </ code>详细信息

ibi is an array with 2 dimension and 400 elements. ibi是具有2维和400个元素的数组。 nBins = 32

This is the output: 这是输出:

产生的直方图

Now I want to render the same chart but in a .NET web application. 现在,我想在.NET Web应用程序中呈现相同的图表。 I have the save data (the same array, nBins ). 我有保存数据(相同的数组nBins )。 How can I display the same values? 如何显示相同的值?

The definition of the 32 bins chosen by hist can be obtained by saving the second output argument which contains the value at the center of each bin : 可以通过保存第二个输出参数来获得hist选择的32个bin的定义,该参数包含每个bin中心的值

[~,centers] = hist(h.axesHistIBI,ibi(:,2),nBins);

You can then use your favorite .NET package to use the same bin centers to count the values in your .NET copy of ibi and render the resulting histogram. 然后,您可以使用自己喜欢的.NET包来使用相同的bin中心来对ibi的.NET副本中的值进行计数,并渲染结果直方图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM