Skip to content

Commit da84dc3

Browse files
committed
fix userinput
1 parent b69e00e commit da84dc3

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
@@ -96,6 +96,9 @@ saveEventsFile('close', expParameters, logFile);
9696

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

99+
By default this will return `expParameters.session = 1` even if you asked it to omit enquiring about sessions. This means
100+
that the folder tree will always include a session folder.
101+
99102
```matlab
100103
[expParameters] = userInputs(cfg, expParameters)
101104
```
@@ -111,19 +114,21 @@ it will only ask you about session
111114

112115
if you use it with `expParameters.askGrpSess = [1 1]`
113116
it will ask you about both
114-
this is the defaut
117+
this is the default
115118

116119

117120
### createFilename
118121

119122
Create the BIDS compliant directories and filenames (but not the files) for the behavioral
120123
output for this subject / session / run.
121124

125+
The folder tree will always include a session folder.
126+
122127
Will also create the right filename for the eye-tracking data file.
123128

124129
For the moment the date of acquisition is appended to the filename
125-
- can work for behavioral experiment if cfg.device is set to 'PC'
126-
- can work for fMRI experiment if cfg.device is set to 'scanner'
130+
- can work for behavioral experiment if cfg.testingDevice is set to 'PC'
131+
- can work for fMRI experiment if cfg.testingDevice is set to 'mri'
127132
- can work for simple eyetracking data if cfg.eyeTracker is set to 1
128133

129134
### 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)