-
Notifications
You must be signed in to change notification settings - Fork 4
/
aamod_firstlevel_subdata2spm.m
33 lines (30 loc) · 1.16 KB
/
aamod_firstlevel_subdata2spm.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
% [aap,resp]=aamod_firstlevel_subdata2spm(aap,task,subj)
function [aap,resp]=aamod_firstlevel_subdata2spm(aap,task,subj)
resp = '';
switch task
case 'report'
case 'checkrequirements'
case 'doit'
% find subject name
subname = aap.acq_details.subjects(subj).mriname;
ts = aap.tasklist.currenttask.settings;
% find exp dir
expdir = fileparts(which(ts.experimentname));
infile = fullfile(expdir,'subjects',subname,...
['data_' ts.experimentname],'subdata.mat');
% load events (also load psychtoolbox to prevent crashes)
oldpath = path;
start_psychtoolbox;
subdata = loadbetter(infile);
path(oldpath);
data = subdata2aa(subdata,aap,ts.sessiontarget,1);
spmpath = aas_getfiles_bystream(aap,subj,'firstlevel_spm');
load(spmpath);
SPM = subdata2spm(data,SPM,ts.duration,ts.ignorenames,...
ts.collapsenames,ts.modelresponses,ts.offset);
% save and describe
save(spmpath,'SPM');
aap = aas_desc_outputs(aap,subj,'firstlevel_spm',spmpath);
otherwise
aas_log(aap,1,sprintf('Unknown task %s',task));
end