Skip to content

Commit 5ccc003

Browse files
authored
Merge pull request #41 from Remi-Gau/remi-fix_user_input
MERGING !!!!! 🚀
2 parents 1c534db + da84dc3 commit 5ccc003

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ saveEventsFile('close', expParameters, logFile);
8888

8989
Get subject, run and session number and make sure they are positive integer values.
9090

91+
By default this will return `expParameters.session = 1` even if you asked it to omit enquiring about sessions. This means
92+
that the folder tree will always include a session folder.
93+
9194
```matlab
9295
[expParameters] = userInputs(cfg, expParameters)
9396
```
@@ -103,19 +106,21 @@ it will only ask you about session
103106

104107
if you use it with `expParameters.askGrpSess = [1 1]`
105108
it will ask you about both
106-
this is the defaut
109+
this is the default
107110

108111

109112
### createFilename
110113

111114
Create the BIDS compliant directories and filenames (but not the files) for the behavioral
112115
output for this subject / session / run.
113116

117+
The folder tree will always include a session folder.
118+
114119
Will also create the right filename for the eye-tracking data file.
115120

116121
For the moment the date of acquisition is appended to the filename
117-
- can work for behavioral experiment if cfg.device is set to 'PC'
118-
- can work for fMRI experiment if cfg.device is set to 'scanner'
122+
- can work for behavioral experiment if cfg.testingDevice is set to 'PC'
123+
- can work for fMRI experiment if cfg.testingDevice is set to 'mri'
119124
- can work for simple eyetracking data if cfg.eyeTracker is set to 1
120125

121126
### saveEventsFile

tests/userInput_test.m

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
%%
2+
cfg = struct('debug', true);
3+
expParameters = struct();
4+
5+
[expParameters] = userInputs(cfg, expParameters);
6+
disp(expParameters)
7+
8+
9+
%%
10+
cfg = struct('debug', false);
11+
expParameters = struct('askGrpSess', 0);
12+
13+
[expParameters] = userInputs(cfg, expParameters);
14+
disp(expParameters)
15+
16+
%%
17+
cfg = struct('debug', false);
18+
expParameters = struct('askGrpSess', [0 0]);
19+
20+
[expParameters] = userInputs(cfg, expParameters);
21+
disp(expParameters)
22+
23+
%%
24+
cfg = struct('debug', false);
25+
expParameters = struct('askGrpSess', [0 1]);
26+
27+
[expParameters] = userInputs(cfg, expParameters);
28+
disp(expParameters)
29+
30+
%%
31+
cfg = struct('debug', false);
32+
expParameters = struct('askGrpSess', []);
33+
34+
[expParameters] = userInputs(cfg, expParameters);
35+
disp(expParameters)

userInputs.m

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,19 @@
1414
if nargin < 2
1515
expParameters = [];
1616
end
17-
if ~isfield(expParameters, 'askGrpSess') || isempty(expParameters.askGrpSess)
18-
askGrpSess = [true true];
19-
else
17+
18+
askGrpSess = [true true];
19+
if isfield(expParameters, 'askGrpSess') && ~isempty(expParameters.askGrpSess)
2020
askGrpSess = expParameters.askGrpSess;
2121
end
22+
if numel(askGrpSess) < 2
23+
askGrpSess(2) = 1;
24+
end
25+
26+
subjectGrp = '';
27+
subjectNb = []; %#ok<*NASGU>
28+
sessionNb = [];
29+
runNb = [];
2230

2331
% When in debug more this function returns some dummy values
2432
if cfg.debug

0 commit comments

Comments
 (0)