[英]Save frequency data of histogram in Matlab
I have two data set that been read from a txt file. 我有两个从txt文件读取的数据集。 I plot two histogram as picture below. 我绘制了两个直方图,如下图。 How can i get and save the frequency data of this histogram? 如何获取和保存此直方图的频率数据? (i checked at the workspace, but no frequency values) (我在工作区检查过,但没有频率值)
Note: X-Axis are values from txt file Y-Axis are the frequency 注意:X轴是txt文件中的值Y轴是频率
The coding of above histogram plot. 上面直方图的编码。
clear;
clc;
filename = 'DistanceValue1.txt';
filename1 = 'DistanceValue2.txt';
A = importdata(filename);
B = importdata(filename1);
h1 = histogram (A,50);
hold on
h2 = histogram (B,50);
hold off
histogram
is a Matlab class for plotting data distributions. histogram
是用于绘制数据分布的Matlab类。 If you want access to the data use histcounts
. 如果要访问数据,请使用histcounts
。 Use 采用
[n1, edges] = histcounts(A, 50);
[n2, edges] = histcounts(B, 50);
histogram
对象在Values
属性中包含其频率数据,可以通过以下方式访问该数据:
h1counts = h1.Values;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.