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
80 changes: 59 additions & 21 deletions initEnv.m
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
%
% 1 - Check if version requirements
% are satisfied and the packages are
% are installed/loaded:
% Octave > 4
% - image
% - optim
% - struct
% - statistics
%
% MATLAB >= R2015b
%
% 2 - Add project to the O/M path

function initEnv
function initEnv(varargin)
%
% 1 - Check if version requirements are satisfied and the packages are are installed/loaded:
% Octave > 4
% - image
% - optim
% - struct
% - statistics
%
% MATLAB >= R2015b
%
% 2 - Add project to the O/M path
%
% USAGE::
%
% initEnv
% initEnv('init')
% initEnv('uninit')
%
% :param action:
% :type action: string
%
% :returns: - :action: (type) (dimension)
%
% Example::
%

% (C) Copyright 2022 CPP_BIDS developers

p = inputParser;

defaultAction = 'init';

addOptional(p, 'action', defaultAction, @ischar);
% addParameter(p, 'verbose', true);

parse(p, varargin{:});

action = p.Results.action;
% verbose = p.Results.verbose;

% Check Matlab and Octave version

octaveVersion = '4.0.3';
matlabVersion = '8.6.0';
Expand Down Expand Up @@ -59,7 +86,7 @@
'Try this in your terminal:', ...
' git submodule update --recursive ']);
else
addDependencies();
addDependencies(action);
end

disp('Correct matlab/octave versions and added to the path!');
Expand Down Expand Up @@ -96,13 +123,24 @@ function tryInstallFromForge(packageName)

end

function addDependencies()
function addDependencies(action)

pth = fileparts(mfilename('fullpath'));
addpath(fullfile(pth, 'lib', 'CPP_BIDS'));
addpath(genpath(fullfile(pth, 'lib', 'CPP_PTB', 'src')));
addpath(fullfile(pth, 'subfun'));

checkCppBidsDependencies();
switch lower(action)

case 'init'

run(fullfile(pth, 'lib', 'CPP_PTB', 'cpp_ptb'));
run(fullfile(pth, 'lib', 'CPP_BIDS', 'cpp_bids'));
addpath(genpath(fullfile(pth, 'src')));

case 'uninit'

cpp_ptb('uninit');
cpp_bids('uninit');
rmpath(genpath(fullfile(pth, 'src')));

end

end
2 changes: 1 addition & 1 deletion lib/CPP_BIDS
2 changes: 1 addition & 1 deletion lib/CPP_PTB
Submodule CPP_PTB updated 2 files
+2 −3 README.md
+2 −2 cpp_ptb.m
4 changes: 3 additions & 1 deletion mainScript.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end

% make sure we got access to all the required functions and inputs
initEnv();
initEnv('init');

% set and load all the parameters to run the experiment
cfg = setParameters;
Expand Down Expand Up @@ -125,6 +125,8 @@

cleanUp();

initEnv('uninit');

catch

cleanUp();
Expand Down