Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ saveEventsFile('close', expParameters, logFile);

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

By default this will return `expParameters.session = 1` even if you asked it to omit enquiring about sessions. This means
that the folder tree will always include a session folder.

```matlab
[expParameters] = userInputs(cfg, expParameters)
```
Expand All @@ -111,19 +114,21 @@ it will only ask you about session

if you use it with `expParameters.askGrpSess = [1 1]`
it will ask you about both
this is the defaut
this is the default


### createFilename

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

The folder tree will always include a session folder.

Will also create the right filename for the eye-tracking data file.

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

### saveEventsFile
Expand Down
35 changes: 35 additions & 0 deletions tests/userInput_test.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
%%
cfg = struct('debug', true);
expParameters = struct();

[expParameters] = userInputs(cfg, expParameters);
disp(expParameters)


%%
cfg = struct('debug', false);
expParameters = struct('askGrpSess', 0);

[expParameters] = userInputs(cfg, expParameters);
disp(expParameters)

%%
cfg = struct('debug', false);
expParameters = struct('askGrpSess', [0 0]);

[expParameters] = userInputs(cfg, expParameters);
disp(expParameters)

%%
cfg = struct('debug', false);
expParameters = struct('askGrpSess', [0 1]);

[expParameters] = userInputs(cfg, expParameters);
disp(expParameters)

%%
cfg = struct('debug', false);
expParameters = struct('askGrpSess', []);

[expParameters] = userInputs(cfg, expParameters);
disp(expParameters)
14 changes: 11 additions & 3 deletions userInputs.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@
if nargin < 2
expParameters = [];
end
if ~isfield(expParameters, 'askGrpSess') || isempty(expParameters.askGrpSess)
askGrpSess = [true true];
else

askGrpSess = [true true];
if isfield(expParameters, 'askGrpSess') && ~isempty(expParameters.askGrpSess)
askGrpSess = expParameters.askGrpSess;
end
if numel(askGrpSess) < 2
askGrpSess(2) = 1;
end

subjectGrp = '';
subjectNb = []; %#ok<*NASGU>
sessionNb = [];
runNb = [];

% When in debug more this function returns some dummy values
if cfg.debug
Expand Down