How to compare counts of each histogram
4 views (last 30 days)
Show older comments
Hello everyone, i hope you are doing well. i have the eight clusters. I want to calculate histogram for each cluster, after calculating histogram, i want to compare the count of each values if the count is greater in one cluster assign the value to other cluster and repeat the process till 8 clusters
How can i do that in MATLAB
I have the following code.
for i = 1:8
T = clusters{i}(:,2);
h1(i)=histogram(T,100000,'BinLimitsMode','manual','BinLimits',[0 3e8]);
end
7 Comments
Answers (1)
Saksham Gupta
on 14 Jun 2022
As per my understanding, you are unable to find the count value of histograms whose data is present with you.
‘Values’ attribute helps us to get bin count in histogram in MATLAB
Following code will help you in getting a cell array having count values of each Histogram:
clusters=num2cell(load('matlab.mat'));
h1= cell(1,8);
for i = 1:8
T = clusters{1,1}.clusters{i,1}(:,2);
z =histogram(T,100000,'BinLimitsMode','manual','BinLimits',[0 3e8]);
disp(z.Values)
h1{i}=z.Values;
end
You may also refer to the following documentation:
7 Comments
Image Analyst
on 14 Jun 2022
And the explanation???
s = load('matlab.mat')
clusters = s.clusters % a cell array
for k = 1 : numel(clusters)
subplot(3, 3, k);
histogram(clusters{k});
grid on;
ylabel('Count');
xlabel('Value');
end
What do the 5 columns, and variable number of rows represent?
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!