-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_histogram.m
36 lines (34 loc) · 1.04 KB
/
plot_histogram.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function plot_histogram(all_data, features, classes)
% Init histogram
for data = all_data
if ~isempty(classes) && isempty(find(data.Genre == classes, 1))
continue
end
for i = 1:length(features)
histograms.(features(i)).(data.Genre) = [];
end
end
% Structure data for histogram
for data = all_data
if ~isempty(classes) && isempty(find(data.Genre == classes, 1))
continue
end
for i = 1:length(features)
histograms.(features(i)).(data.Genre) = [histograms.(features(i)).(data.Genre), data.(features(i))];
end
end
% Generate histogram plot
features = fieldnames(histograms);
figure
for f = 1:length(features)
nexttile
labels = fieldnames(histograms.(features{f}));
for l = 1:length(labels)
histogram(histograms.(features{f}).(labels{l}), 0:0.05:1)
hold on
end
title(features{f}, Interpreter="none")
% legend(labels)
hold off
end
end