-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsenderAnalysis_plot.m
55 lines (39 loc) · 1.8 KB
/
senderAnalysis_plot.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
46
47
48
49
50
51
52
53
54
function senderAnalysis_plot(participants)
% Gets the top sender for each participant, and plots their priority,
% workload and pleasure values in a 3d plot
%% make table with top senders
% consider only rows: from, priority, pleasure, workload, spam
% eagerlyExpected
columns = {'from' 'priority' 'pleasure' 'workload' 'spam' 'eagerlyExpected'};
cattable = table();
fig = figure;
hold on;
for participantNumber = participants
sfo = ['P' Params.sfo_p];
partString = sprintf(sfo, participantNumber);
outdir = Params.outdir;
partFolder = [outdir filesep partString];
tableMatFile = [partFolder filesep 'datatable.mat'];
disp(['Attempting to read table from ' tableMatFile]);
tables = load(tableMatFile);
tab = tables.tab;
% get top sender
[uniqueValues, ~, uniqueIndex] = unique(tab.from);
frequencies = accumarray(uniqueIndex(:),1);
[maxfreq, maxI] = max(frequencies);
topSender = uniqueValues(maxI);
topSenderIs = find(strcmp(tab.from, topSender));
% make sub table with only top sender and the desired colums
subtab = tab(topSenderIs, columns);
% add a little randomness to prevent overlap
priority = subtab.priority + rand(size(subtab.priority, 1), 1) / 2;
pleasure = subtab.pleasure + rand(size(subtab.pleasure, 1), 1) / 2;
workload = subtab.workload + rand(size(subtab.workload, 1), 1) / 2;
scatter3(priority, pleasure, workload)
subtab.participantNumber = repmat(participantNumber, size(subtab, 1), 1);
cattable = vertcat(cattable, subtab);
end
xlabel('Priority');
ylabel('Pleasure');
zlabel('Workload');
end