|
1 | 1 | function [expParameters, cfg] = checkCFG(cfg, expParameters) |
2 | | -% check that we have all the fields that we need in the experiment |
3 | | -% parameters |
| 2 | + % check that we have all the fields that we need in the experiment |
| 3 | + % parameters |
4 | 4 |
|
5 | | -if ~isfield(expParameters, 'verbose') || isempty(expParameters.verbose) |
6 | | - expParameters.verbose = 0; |
7 | | -end |
| 5 | + if ~isfield(expParameters, 'verbose') || isempty(expParameters.verbose) |
| 6 | + expParameters.verbose = 0; |
| 7 | + end |
8 | 8 |
|
9 | | -if ~isfield(expParameters, 'outputDir') |
10 | | - expParameters.outputDir = fullfile(... |
11 | | - fileparts(mfilename('fullpath')), ... |
12 | | - '..', ... |
13 | | - 'output'); |
14 | | -end |
| 9 | + if ~isfield(expParameters, 'outputDir') |
| 10 | + expParameters.outputDir = fullfile( ... |
| 11 | + fileparts(mfilename('fullpath')), ... |
| 12 | + '..', ... |
| 13 | + 'output'); |
| 14 | + end |
15 | 15 |
|
16 | | -% set empty values for a series of field if they have not been specified |
17 | | -% 'ce' |
18 | | -% 'dir' For BIDS file naming: phase encoding direction of acquisition for fMRI |
19 | | -% 'rec' For BIDS file naming: reconstruction of fMRI images |
20 | | -% 'echo' For BIDS file naming: echo fMRI images |
21 | | -% 'acq' For BIDS file naming: acquisition of fMRI images |
22 | | -% 'subjectGrp' in case no group was provided |
23 | | -% 'sessionNb' in case no session was provided |
24 | | - |
25 | | -fields2Check = { ... |
26 | | - 'ce', ... |
27 | | - 'dir', ... |
28 | | - 'rec', ... |
29 | | - 'echo', ... |
30 | | - 'acq', ... |
31 | | - 'subjectGrp', ... |
32 | | - 'sessionNb'}; |
33 | | - |
34 | | -for iField = 1:numel(fields2Check) |
35 | | - if ~isfield(expParameters, fields2Check{iField}) |
36 | | - expParameters = setfield(expParameters, fields2Check{iField}, []); %#ok<SFLD> |
| 16 | + % set empty values for a series of field if they have not been specified |
| 17 | + % 'ce' |
| 18 | + % 'dir' For BIDS file naming: phase encoding direction of acquisition for fMRI |
| 19 | + % 'rec' For BIDS file naming: reconstruction of fMRI images |
| 20 | + % 'echo' For BIDS file naming: echo fMRI images |
| 21 | + % 'acq' For BIDS file naming: acquisition of fMRI images |
| 22 | + % 'subjectGrp' in case no group was provided |
| 23 | + % 'sessionNb' in case no session was provided |
| 24 | + |
| 25 | + fields2Check = { ... |
| 26 | + 'ce', ... |
| 27 | + 'dir', ... |
| 28 | + 'rec', ... |
| 29 | + 'echo', ... |
| 30 | + 'acq', ... |
| 31 | + 'subjectGrp', ... |
| 32 | + 'sessionNb'}; |
| 33 | + |
| 34 | + for iField = 1:numel(fields2Check) |
| 35 | + if ~isfield(expParameters, fields2Check{iField}) |
| 36 | + expParameters = setfield(expParameters, fields2Check{iField}, []); %#ok<SFLD> |
| 37 | + end |
37 | 38 | end |
38 | | -end |
39 | 39 |
|
40 | | -% set false value for a series of field if they have not been specified |
41 | | -fields2CheckFalse = { ... |
42 | | - 'eyeTracker' |
43 | | - }; |
| 40 | + % set false value for a series of field if they have not been specified |
| 41 | + fields2CheckFalse = { ... |
| 42 | + 'eyeTracker' |
| 43 | + }; |
44 | 44 |
|
45 | | -for iField = 1:numel(fields2CheckFalse) |
46 | | - if ~isfield(cfg, fields2CheckFalse{iField}) |
47 | | - cfg = setfield(cfg, fields2CheckFalse{iField}, false); %#ok<SFLD> |
| 45 | + for iField = 1:numel(fields2CheckFalse) |
| 46 | + if ~isfield(cfg, fields2CheckFalse{iField}) |
| 47 | + cfg = setfield(cfg, fields2CheckFalse{iField}, false); %#ok<SFLD> |
| 48 | + end |
48 | 49 | end |
49 | | -end |
50 | | - |
51 | | -% other defaults |
52 | | -if ~isfield(expParameters, 'askGrpSess') |
53 | | - expParameters.askGrpSess = [true true]; |
54 | | -end |
55 | 50 |
|
| 51 | + % other defaults |
| 52 | + if ~isfield(expParameters, 'askGrpSess') |
| 53 | + expParameters.askGrpSess = [true true]; |
| 54 | + end |
56 | 55 |
|
57 | 56 | end |
0 commit comments