diff --git a/README.md b/README.md index 5cf60913..fa4627e1 100644 --- a/README.md +++ b/README.md @@ -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) ``` @@ -111,7 +114,7 @@ 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 @@ -119,11 +122,13 @@ this is the defaut 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 diff --git a/tests/userInput_test.m b/tests/userInput_test.m new file mode 100644 index 00000000..aa197617 --- /dev/null +++ b/tests/userInput_test.m @@ -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) \ No newline at end of file diff --git a/userInputs.m b/userInputs.m index 6561f2a2..8b4a6a2c 100644 --- a/userInputs.m +++ b/userInputs.m @@ -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