forked from racheldenison/temporal-attention
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rd_combineSubjectsTemporalAttentionAdjust.m
58 lines (47 loc) · 1.64 KB
/
rd_combineSubjectsTemporalAttentionAdjust.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
% rd_combineSubjectsTemporalAttentionAdjust.m
%% setup
subjectIDs = {'bl','rd','id','ec','ld','en','sj','ml','ca','jl','ew','jx'};
nSubjects = numel(subjectIDs);
run = 9;
expName = 'E3_adjust';
%% initialize super-subject structure
SS.expt.trials = [];
SS.expt.targetRotations = [];
for iV = 1:3
for iT = 1:2
SS.results.totals.all{iV,iT} = [];
end
end
%% combine subjects
for iSubject = 1:nSubjects
subjectID = subjectIDs{iSubject};
fprintf('%s\n', subjectID)
% load data
subject = sprintf('%s_a1_tc100_soa1000-1250', subjectID);
dataDir = pathToExpt('data');
dataDir = sprintf('%s/%s/%s', dataDir, expName, subject(1:2));
dataFile = dir(sprintf('%s/%s_run%02d*', dataDir, subject, run));
load(sprintf('%s/%s', dataDir, dataFile(1).name))
% add subject data to super subject structure
SS.expt.trials = [SS.expt.trials; expt.trials];
SS.expt.targetRotations = [SS.expt.targetRotations; expt.targetRotations];
for iV = 1:3
for iT = 1:2
SS.results.totals.all{iV,iT} = [SS.results.totals.all{iV,iT}; results.totals.all{iV,iT}];
end
end
end
% can set this just once
SS.expt.p = expt.p;
SS.expt.trials_headers = expt.trials_headers;
%% save expt and results as for a normal subject
clear expt results
subject = 'SS_a1_tc100_soa1000-1250';
dataDir = pathToExpt('data');
dataDir = sprintf('%s/%s/%s', dataDir, expName, subject(1:2));
fileName = sprintf('%s/%s_run%02d_%s', dataDir, subject, run, datestr(now,'yyyymmdd'));
expt = SS.expt;
results = SS.results;
SS.subjectIDs = subjectIDs;
mkdir(dataDir)
save(fileName, 'expt', 'results', 'subject', 'run', 'SS')