|
1 | | -% |
2 | | -% 1 - Check if version requirements |
3 | | -% are satisfied and the packages are |
4 | | -% are installed/loaded: |
5 | | -% Octave > 4 |
6 | | -% - image |
7 | | -% - optim |
8 | | -% - struct |
9 | | -% - statistics |
10 | | -% |
11 | | -% MATLAB >= R2015b |
12 | | -% |
13 | | -% 2 - Add project to the O/M path |
14 | | - |
15 | | -function initEnv |
| 1 | +function initEnv(varargin) |
| 2 | + % |
| 3 | + % 1 - Check if version requirements are satisfied and the packages are are installed/loaded: |
| 4 | + % Octave > 4 |
| 5 | + % - image |
| 6 | + % - optim |
| 7 | + % - struct |
| 8 | + % - statistics |
| 9 | + % |
| 10 | + % MATLAB >= R2015b |
| 11 | + % |
| 12 | + % 2 - Add project to the O/M path |
| 13 | + % |
| 14 | + % USAGE:: |
| 15 | + % |
| 16 | + % initEnv |
| 17 | + % initEnv('init') |
| 18 | + % initEnv('uninit') |
| 19 | + % |
| 20 | + % :param action: |
| 21 | + % :type action: string |
| 22 | + % |
| 23 | + % :returns: - :action: (type) (dimension) |
| 24 | + % |
| 25 | + % Example:: |
| 26 | + % |
| 27 | + |
| 28 | + % (C) Copyright 2022 CPP_BIDS developers |
| 29 | + |
| 30 | + p = inputParser; |
| 31 | + |
| 32 | + defaultAction = 'init'; |
| 33 | + |
| 34 | + addOptional(p, 'action', defaultAction, @ischar); |
| 35 | + % addParameter(p, 'verbose', true); |
| 36 | + |
| 37 | + parse(p, varargin{:}); |
| 38 | + |
| 39 | + action = p.Results.action; |
| 40 | + % verbose = p.Results.verbose; |
| 41 | + |
| 42 | + % Check Matlab and Octave version |
16 | 43 |
|
17 | 44 | octaveVersion = '4.0.3'; |
18 | 45 | matlabVersion = '8.6.0'; |
|
59 | 86 | 'Try this in your terminal:', ... |
60 | 87 | ' git submodule update --recursive ']); |
61 | 88 | else |
62 | | - addDependencies(); |
| 89 | + addDependencies(action); |
63 | 90 | end |
64 | 91 |
|
65 | 92 | disp('Correct matlab/octave versions and added to the path!'); |
@@ -96,13 +123,24 @@ function tryInstallFromForge(packageName) |
96 | 123 |
|
97 | 124 | end |
98 | 125 |
|
99 | | -function addDependencies() |
| 126 | +function addDependencies(action) |
100 | 127 |
|
101 | 128 | pth = fileparts(mfilename('fullpath')); |
102 | | - addpath(fullfile(pth, 'lib', 'CPP_BIDS')); |
103 | | - addpath(genpath(fullfile(pth, 'lib', 'CPP_PTB', 'src'))); |
104 | | - addpath(fullfile(pth, 'subfun')); |
105 | 129 |
|
106 | | - checkCppBidsDependencies(); |
| 130 | + switch lower(action) |
| 131 | + |
| 132 | + case 'init' |
| 133 | + |
| 134 | + run(fullfile(pth, 'lib', 'CPP_PTB', 'cpp_ptb')); |
| 135 | + run(fullfile(pth, 'lib', 'CPP_BIDS', 'cpp_bids')); |
| 136 | + addpath(genpath(fullfile(pth, 'src'))); |
| 137 | + |
| 138 | + case 'uninit' |
| 139 | + |
| 140 | + cpp_ptb('uninit'); |
| 141 | + cpp_bids('uninit'); |
| 142 | + rmpath(genpath(fullfile(pth, 'src'))); |
| 143 | + |
| 144 | + end |
107 | 145 |
|
108 | 146 | end |
0 commit comments