-
Notifications
You must be signed in to change notification settings - Fork 0
/
runme.m
90 lines (76 loc) · 2.5 KB
/
runme.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
87
88
89
90
function runme(name, trigger, stim_set, num_runs, task_num, start_run)
% Prompts experimenter for session parameters and executes functional
% localizer experiment used to define regions in high-level visual cortex
% selective to faces, places, bodies, and printed characters.
%
% Inputs (optional):
% 1) name -- session-specific identifier (e.g., particpant's initials)
% 2) trigger -- option to trigger scanner (0 = no, 1 = yes)
% 3) stim_set -- stimulus set (1 = standard, 2 = alternate, 3 = both)
% 4) num_runs -- number of runs (stimuli repeat after 2 runs/set)
% 5) task_num -- which task (1 = 1-back, 2 = 2-back, 3 = oddball)
% 6) start_run -- run number to begin with (if sequence is interrupted)
%
% Version 3.0 8/2017
% Anthony Stigliani ([email protected])
% Department of Psychology, Stanford University
%% add paths and check inputs
addpath('functions');
% session name
if nargin < 1
name = [];
while isempty(deblank(name))
name = input('Subject initials : ', 's');
end
end
% option to trigger scanner
if nargin < 2
trigger = -1;
while ~ismember(trigger, 0:1)
trigger = input('Trigger scanner? (0 = no, 1 = yes) : ');
end
end
% which stimulus set/s to use
if nargin < 3
stim_set = -1;
while ~ismember(stim_set, 1:3)
stim_set = input('Which stimulus set? (1 = standard, 2 = alternate, 3 = both) : ');
end
end
% number of runs to generate
if nargin < 4
num_runs = -1;
while ~ismember(num_runs, 1:24)
num_runs = input('How many runs? : ');
end
end
% which task to use
if nargin < 5
task_num = -1;
while ~ismember(task_num, 1:3)
task_num = input('Which task? (1 = 1-back, 2 = 2-back, 3 = oddball) : ');
end
end
% which run number to begin executing (default = 1)
if nargin < 6
start_run = 1;
end
%% initialize session object and execute experiment
% setup fLocSession and save session information
session = fLocSession(name, trigger, stim_set, num_runs, task_num);
session = load_seqs(session);
session_dir = (fullfile(session.exp_dir, 'data', session.id));
if ~exist(session_dir, 'dir') == 7
mkdir(session_dir);
end
fpath = fullfile(session_dir, [session.id '_fLocSession.mat']);
save(fpath, 'session', '-v7.3');
% execute all runs from start_run to num_runs and save parfiles
fname = [session.id '_fLocSession.mat'];
fpath = fullfile(session.exp_dir, 'data', session.id, fname);
for rr = start_run:num_runs
session = run_exp(session, rr);
save(fpath, 'session', '-v7.3');
end
write_parfiles(session);
end