-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgroup_analysis.m
59 lines (40 loc) · 1.43 KB
/
group_analysis.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
ccc
sub_nums = {'000', '001', '002', '003', '004', '005', '006', '007',...
'008', '009', '010', '011', '012'};
nsubs = length(sub_nums);
figure('Position',[25,25,1000,1000]);
widthHeight = ceil(sqrt(nsubs));
for i_sub = 1:nsubs
current_sub = sub_nums{i_sub};
%Find output filename
Filename = dir(['.\Data\' current_sub '*']);
%% Save data
load(['.\Data\' Filename.name]);
if i_sub == 1 % make output variables here once loaded first file
turn_group = zeros(nsubs,length(soas));
control_group = zeros(nsubs,length(soas));
end
%% Plot results
subplot(widthHeight,widthHeight,i_sub);
plot(soas,turn_out,'r',soas,control_out,'b');
legend({'Flexion','Control'});
xlim([min(soas) max(soas)]);
set(gca,'XTick',min(soas):1:max(soas))
xlabel('Gabor First < -- SOA (frames) -- > Gabor After')
ylabel('Detection Proportion')
ylim([.01 1.05])
title(current_sub)
turn_group(i_sub,:) = turn_out;
control_group(i_sub,:) = control_out;
end
%% Plot Grand Average results
figure;
boundedline(soas, mean(turn_group,1), std(turn_group,[],1) / sqrt(nsubs),'r', ...
soas, mean(control_group,1), std(control_group,[],1) / sqrt(nsubs),'b');
legend({'Flexion','Control'});
xlim([min(soas) max(soas)]);
set(gca,'XTick',min(soas):1:max(soas))
xlabel('Gabor Change First < ------ SOA (frames) ------ > Gabor Change After')
ylabel('Detection Proportion')
ylim([.01 1.05])
title('Grand Average')