-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExamplePsychtoolbox_OnsetFile .m
34 lines (29 loc) · 1.25 KB
/
ExamplePsychtoolbox_OnsetFile .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
function ExamplePsychtoolbox_OnsetFile(ID,RUN)
% This function allows you to extract onest time and name of
% conditions/events from the experiment SemDist.
%% Directory
setup=0
if setup==0 % pc
inputdir='D:\Documents and Settings\mpiazza\Desktop\MATLAB_VB\wiki\ExamplePsychtoolbox/results';
outputdir='D:\Documents and Settings\mpiazza\Desktop\MATLAB_VB\wiki\ExamplePsychtoolbox/onsetfile';
elseif setup==1 % fMRI
inputdir='/neurospin/unicog/protocols/IRMf/TOBEADDED';
outputdir='/neurospin/unicog/protocols/IRMf/TOBEADDED';
end;
cd(inputdir)
%% Extract list of stimuli and list of onset time
load([ID, '_ExamplePsych_run' num2str(RUN) '.mat']);
names=stimlist;
onsets=stimonset;
%% Create onsets file
rest=(names>34); % identify which trials where rest
odd=(names>24 & names<35); % indentify which trials where odds
names(odd)=25
names(rest)=[]; % subtract rest trials
onsets(rest)=[]; % subtract rest trials
durations=zeros(size(names));
onsetsfile=[names;onsets;durations]'
%% Save onsets file
cd(outputdir)
save([num2str(ID) '_OnsetsFile_run' num2str(RUN) ],'onsetsfile');
end