From 250c7b38b8649e68fa2761666efcd5433ea7f100 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Fri, 29 May 2020 14:19:58 +0200 Subject: [PATCH] make askGrpSess a field of expParameters --- README.md | 18 ++++++++++++++++++ checkCFG.m | 14 ++++++++++---- userInputs.m | 8 +++++--- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 26d96156..99b6b4fe 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,24 @@ saveEventsFile('close', expParameters, logFile); Get subject, run and session number and make sure they are positive integer values. +```matlab +[expParameters] = userInputs(cfg, expParameters) +``` + +if you use it with `expParameters.askGrpSess = [0 0]` +it won't ask you about group or session + +if you use it with `expParameters.askGrpSess = [1]` +it will only ask you about group + +if you use it with `expParameters.askGrpSess = [0 1]` +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 + + ### createFilename Create the BIDS compliant directories and filenames (but not the files) for the behavioral diff --git a/checkCFG.m b/checkCFG.m index e421658d..c97834ce 100644 --- a/checkCFG.m +++ b/checkCFG.m @@ -31,21 +31,27 @@ 'subjectGrp', ... 'sessionNb'}; -fields2CheckFalse = { ... - 'eyeTracker' - }; - for iField = 1:numel(fields2Check) if ~isfield(expParameters, fields2Check{iField}) expParameters = setfield(expParameters, fields2Check{iField}, []); %#ok end end +% set false value for a series of field if they have not been specified +fields2CheckFalse = { ... + 'eyeTracker' + }; + for iField = 1:numel(fields2CheckFalse) if ~isfield(cfg, fields2CheckFalse{iField}) cfg = setfield(cfg, fields2CheckFalse{iField}, false); %#ok end end +% other defaults +if ~isfield(expParameters, 'askGrpSess') + expParameters.askGrpSess = [true true]; +end + end diff --git a/userInputs.m b/userInputs.m index 5594cf6f..f1863148 100644 --- a/userInputs.m +++ b/userInputs.m @@ -1,8 +1,8 @@ -function [expParameters] = userInputs(cfg, expParameters, askGrpSess) +function [expParameters] = userInputs(cfg, expParameters) % Get subject, run and session number and make sure they are % positive integer values % -% askGrpSess +% expParameters.askGrpSess % a 1 X 2 array of booleans (default is [true true] ): % - the first value set to false will skip asking for the participants % group @@ -14,8 +14,10 @@ if nargin<2 expParameters = []; end -if nargin<3 || isempty(askGrpSess) +if ~isfield(expParameters, 'askGrpSess') || isempty(expParameters.askGrpSess) askGrpSess = [true true]; +else + askGrpSess = expParameters.askGrpSess; end