Skip to content

Commit

Permalink
Merge pull request #35 from Remi-Gau/remi-change_userInput
Browse files Browse the repository at this point in the history
make askGrpSess  a field of expParameters
  • Loading branch information
Remi-Gau authored May 29, 2020
2 parents c532362 + 250c7b3 commit 232ace3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions checkCFG.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,27 @@
'subjectGrp', ...
'sessionNb'};

fields2CheckFalse = { ...
'eyeTracker'
};

for iField = 1:numel(fields2Check)
if ~isfield(expParameters, fields2Check{iField})
expParameters = setfield(expParameters, fields2Check{iField}, []); %#ok<SFLD>
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<SFLD>
end
end

% other defaults
if ~isfield(expParameters, 'askGrpSess')
expParameters.askGrpSess = [true true];
end


end
8 changes: 5 additions & 3 deletions userInputs.m
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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


Expand Down

0 comments on commit 232ace3

Please sign in to comment.