-
Notifications
You must be signed in to change notification settings - Fork 0
/
computeCorrelation.m
executable file
·45 lines (42 loc) · 1.56 KB
/
computeCorrelation.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
37
38
39
40
41
42
43
44
45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% MASTER'S THESIS %
% %
% Student: Martin Hellwagner %
% Supervisor: Prof. Stefan Weinzierl (TU Berlin) %
% Advisor: Prof. Anders Friberg (KTH Stockholm) %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Based on the code by Prof. Anders Friberg %
% Re-written and modified by Martin Hellwagner %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function computeCorrelation(features)
% computing correlation coefficients for features
[R,P] = corrcoef(features.data,'rows','pairwise');
% printing names
fprintf('%17s',' ');
for i = 1:length(R(1,:))-1
fprintf('%-12s',features.names{i});
end
fprintf('\n');
% printing results (with stars for significance)
for i = 2:length(R(:,1))
fprintf('%14s',features.names{i});
for j = 1:i-1
stars = ' ';
if (P(i,j) <= 0.05)
stars = ' * ';
end
if (P(i,j) <= 0.01)
stars = ' ** ';
end
if (P(i,j) <= 0.001)
stars = ' ***';
end
fprintf('%7.2f %s',R(i,j),stars);
end
fprintf('\n');
end
end