Skip to content

Commit 232ace3

Browse files
authored
Merge pull request #35 from Remi-Gau/remi-change_userInput
make askGrpSess a field of expParameters
2 parents c532362 + 250c7b3 commit 232ace3

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,24 @@ saveEventsFile('close', expParameters, logFile);
9595

9696
Get subject, run and session number and make sure they are positive integer values.
9797

98+
```matlab
99+
[expParameters] = userInputs(cfg, expParameters)
100+
```
101+
102+
if you use it with `expParameters.askGrpSess = [0 0]`
103+
it won't ask you about group or session
104+
105+
if you use it with `expParameters.askGrpSess = [1]`
106+
it will only ask you about group
107+
108+
if you use it with `expParameters.askGrpSess = [0 1]`
109+
it will only ask you about session
110+
111+
if you use it with `expParameters.askGrpSess = [1 1]`
112+
it will ask you about both
113+
this is the defaut
114+
115+
98116
### createFilename
99117

100118
Create the BIDS compliant directories and filenames (but not the files) for the behavioral

checkCFG.m

+10-4
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,27 @@
3131
'subjectGrp', ...
3232
'sessionNb'};
3333

34-
fields2CheckFalse = { ...
35-
'eyeTracker'
36-
};
37-
3834
for iField = 1:numel(fields2Check)
3935
if ~isfield(expParameters, fields2Check{iField})
4036
expParameters = setfield(expParameters, fields2Check{iField}, []); %#ok<SFLD>
4137
end
4238
end
4339

40+
% set false value for a series of field if they have not been specified
41+
fields2CheckFalse = { ...
42+
'eyeTracker'
43+
};
44+
4445
for iField = 1:numel(fields2CheckFalse)
4546
if ~isfield(cfg, fields2CheckFalse{iField})
4647
cfg = setfield(cfg, fields2CheckFalse{iField}, false); %#ok<SFLD>
4748
end
4849
end
4950

51+
% other defaults
52+
if ~isfield(expParameters, 'askGrpSess')
53+
expParameters.askGrpSess = [true true];
54+
end
55+
5056

5157
end

userInputs.m

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
function [expParameters] = userInputs(cfg, expParameters, askGrpSess)
1+
function [expParameters] = userInputs(cfg, expParameters)
22
% Get subject, run and session number and make sure they are
33
% positive integer values
44
%
5-
% askGrpSess
5+
% expParameters.askGrpSess
66
% a 1 X 2 array of booleans (default is [true true] ):
77
% - the first value set to false will skip asking for the participants
88
% group
@@ -14,8 +14,10 @@
1414
if nargin<2
1515
expParameters = [];
1616
end
17-
if nargin<3 || isempty(askGrpSess)
17+
if ~isfield(expParameters, 'askGrpSess') || isempty(expParameters.askGrpSess)
1818
askGrpSess = [true true];
19+
else
20+
askGrpSess = expParameters.askGrpSess;
1921
end
2022

2123

0 commit comments

Comments
 (0)