-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwristdecel_tweaks.m
86 lines (62 loc) · 3.57 KB
/
wristdecel_tweaks.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
%% P01. 48 trials
data = experiment.P01.trials; % use WristVel12 except 42, 40, 22, 8, 6, 1
except_trials = [1 6 8 40 42];
wristdecel = zeros(size(data, 2), 1);
VisFeedback = cell(size(data, 2), 1);
Cues = cell(size(data, 2), 1);
Direction = cell(size(data, 2), 1);
for i = 1:size(data, 2)
if any(i == except_trials)
[~, dec] = max(data(i).WristVel11);
wristdecel(i) = (length(data(i).WristVel11) - dec) / 130;
else
[~, dec] = max(data(i).WristVel12);
wristdecel(i) = (length(data(i).WristVel12) - dec) / 130;
end
[VisFeedback{i}, rem] = strtok(data(i).Name, '_');
[Cues{i}, rem] = strtok(rem, '_');
Direction{i} = strtok(rem(1:end-4), '_');
end
ocl = strcmp(VisFeedback, 'Occlusion') & strcmp(Cues, 'Cue') & strcmp(Direction, 'LeftToRight');
ocr = strcmp(VisFeedback, 'Occlusion') & strcmp(Cues, 'Cue') & strcmp(Direction, 'RightToLeft');
onl = strcmp(VisFeedback, 'Occlusion') & strcmp(Cues, 'NoCue') & strcmp(Direction, 'LeftToRight');
onr = strcmp(VisFeedback, 'Occlusion') & strcmp(Cues, 'NoCue') & strcmp(Direction, 'RightToLeft');
vcl = strcmp(VisFeedback, 'Visible') & strcmp(Cues, 'Cue') & strcmp(Direction, 'LeftToRight');
vcr = strcmp(VisFeedback, 'Visible') & strcmp(Cues, 'Cue') & strcmp(Direction, 'RightToLeft');
vnl = strcmp(VisFeedback, 'Visible') & strcmp(Cues, 'NoCue') & strcmp(Direction, 'LeftToRight');
vnr = strcmp(VisFeedback, 'Visible') & strcmp(Cues, 'NoCue') & strcmp(Direction, 'RightToLeft');
plot(wristdecel)
means = [mean(wristdecel(ocl)), mean(wristdecel(ocr)), mean(wristdecel(onl)), mean(wristdecel(onr)), ...
mean(wristdecel(vcl)), mean(wristdecel(vcr)), mean(wristdecel(vnl)), mean(wristdecel(vnr))]
final_table(1, :) = [1, means];
%% P12. 48 trials
data = experiment.P12.trials; % use WristVel11 except 10, 22 (-1 because 47 trials)
except_trials = [4 10 22 32];
wristdecel = zeros(size(data, 2), 1);
VisFeedback = cell(size(data, 2), 1);
Cues = cell(size(data, 2), 1);
Direction = cell(size(data, 2), 1);
for i = 1:48
if any(i == except_trials)
[~, dec] = max(data(i).WristVel12);
wristdecel(i) = (length(data(i).WristVel12) - dec) / 130;
else
[~, dec] = max(data(i).WristVel11);
wristdecel(i) = (length(data(i).WristVel11) - dec) / 130;
end
[VisFeedback{i}, rem] = strtok(data(i).Name, '_');
[Cues{i}, rem] = strtok(rem, '_');
Direction{i} = strtok(rem(1:end-4), '_');
end
ocl = strcmp(VisFeedback, 'Occlusion') & strcmp(Cues, 'Cue') & strcmp(Direction, 'LeftToRight');
ocr = strcmp(VisFeedback, 'Occlusion') & strcmp(Cues, 'Cue') & strcmp(Direction, 'RightToLeft');
onl = strcmp(VisFeedback, 'Occlusion') & strcmp(Cues, 'NoCue') & strcmp(Direction, 'LeftToRight');
onr = strcmp(VisFeedback, 'Occlusion') & strcmp(Cues, 'NoCue') & strcmp(Direction, 'RightToLeft');
vcl = strcmp(VisFeedback, 'Visible') & strcmp(Cues, 'Cue') & strcmp(Direction, 'LeftToRight');
vcr = strcmp(VisFeedback, 'Visible') & strcmp(Cues, 'Cue') & strcmp(Direction, 'RightToLeft');
vnl = strcmp(VisFeedback, 'Visible') & strcmp(Cues, 'NoCue') & strcmp(Direction, 'LeftToRight');
vnr = strcmp(VisFeedback, 'Visible') & strcmp(Cues, 'NoCue') & strcmp(Direction, 'RightToLeft');
plot(wristdecel)
means = [mean(wristdecel(ocl)), mean(wristdecel(ocr)), mean(wristdecel(onl)), mean(wristdecel(onr)), ...
mean(wristdecel(vcl)), mean(wristdecel(vcr)), mean(wristdecel(vnl)), mean(wristdecel(vnr))]
final_table(8, :) = [12, means];