-
Notifications
You must be signed in to change notification settings - Fork 1
/
objectFromMap.m
52 lines (46 loc) · 1.96 KB
/
objectFromMap.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
function [validation, percentCorrect, partialCorrect] = objectFromMap()
%OBJECTFROMMAP When fed in the fixation map from the trial number, this
%will figure out the object being shown
settings;
load('subject_data_SR.mat');
load('map_data_SR.mat');
validation(OBJECT_SETS * PER_SET) = struct( ...
'calcSet', 0, ...
'calcObject', 0, ...
'actualSet', 0, ...
'actualObject', 0, ...
'isCorrect', -1 ...
);
for i = 1:OBJECT_SETS
index = find([trials.objectSet] == i);
objectSet = trials(index);
for j = 1:PER_SET
index1 = find([objectSet.leftObject] == j);
index2 = find([objectSet.rightObject] == j);
index = cat(2, index1, index2);
mapSet = objectSet(index);
map = add2Matrix([], mapSet, 'EITHER');
t = matrix2 * map;
index = find(t == max(t(:)));
pos = ((i - 1) * 4) + j;
validation(pos).calcSet = floor(index / 4) + 1;
validation(pos).calcObject = mod(index, 4);
validation(pos).actualSet = i;
validation(pos).actualObject = j;
if validation(pos).calcSet == i && validation(pos).calcObject == j
validation(pos).isCorrect = CORRECT;
elseif validation(pos).calcSet == i
validation(pos).isCorrect = PARTIAL;
else
validation(pos).isCorrect = INCORRECT;
end
end
end
total = size(validation, 2);
numCorrect = size(find([validation.isCorrect] == CORRECT), 2);
numPartial = numCorrect + size(find([validation.isCorrect] == PARTIAL), 2);
% numIncorrect = size(find([validation.isCorrect] == INCORRECT), 2);
percentCorrect = (numCorrect / total) * 100;
partialCorrect = (numPartial / total) * 100;
clear INCORRECT PARTIAL CORRECT index objectSet index1 index2 mapSet map t pos;
end