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 init_env()
2+ %
3+ % 1 - Check if version requirements
4+ % are satisfied and the packages are
5+ % are installed/loaded:
6+ % Octave > 4
7+ % - image
8+ % - optim
9+ % - struct
10+ % - statistics
11+ %
12+ % MATLAB >= R2015b
13+ %
14+ % 2 - Add project to the O/M path
15+ % (C) Copyright 2021 Remi Gau
1616
1717 octaveVersion = ' 4.0.3' ;
1818 matlabVersion = ' 8.6.0' ;
1919
2020 installlist = {' io' , ' statistics' , ' image' };
2121
22- if isOctave
22+ if is_octave
2323
2424 % Exit if min version is not satisfied
2525 if ~compare_versions(OCTAVE_VERSION , octaveVersion , ' >=' )
2828
2929 for ii = 1 : length(installlist )
3030
31- packageName = installlist{ii };
31+ package_name = installlist{ii };
3232
3333 try
3434 % Try loading Octave packages
35- disp([' loading ' packageName ]);
36- pkg(' load' , packageName );
35+ disp([' loading ' package_name ]);
36+ pkg(' load' , package_name );
3737
3838 catch
3939
40- tryInstallFromForge( packageName );
40+ try_install_from_forge( package_name );
4141
4242 end
4343 end
5959 ' Try this in your terminal:' , ...
6060 ' git submodule update --recursive ' ]);
6161 else
62- addDependencies ();
62+ add_dependencies ();
6363 end
6464
6565 disp(' Correct matlab/octave verions and added to the path!' );
6666
6767end
6868
69- function retval = isOctave
69+ function retval = is_octave
7070 % Return: true if the environment is Octave.
7171 persistent cacheval % speeds up repeated calls
7272
7878
7979end
8080
81- function tryInstallFromForge( packageName )
81+ function try_install_from_forge( package_name )
8282
8383 errorcount = 1 ;
8484 while errorcount % Attempt twice in case installation fails
8585 try
86- pkg(' install' , ' -forge' , packageName );
87- pkg(' load' , packageName );
86+ pkg(' install' , ' -forge' , package_name );
87+ pkg(' load' , package_name );
8888 errorcount = 0 ;
8989 catch err
9090 errorcount = errorcount + 1 ;
@@ -96,10 +96,10 @@ function tryInstallFromForge(packageName)
9696
9797end
9898
99- function addDependencies ()
99+ function add_dependencies ()
100100
101101 pth = fileparts(mfilename(' fullpath' ));
102- addpath(genpath( fullfile(pth , ' lib' ) ));
102+ addpath(fullfile(pth , ' lib' , ' bids-matlab ' ));
103103 addpath(genpath(fullfile(pth , ' src' )));
104104
105105end
0 commit comments