-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit_env.m
More file actions
35 lines (30 loc) · 865 Bytes
/
init_env.m
File metadata and controls
35 lines (30 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function init_env()
%
% Adds the relevant folders to the matlab path.
% Also checks that Fieldtrip is in the path and initializes it.
%
% (C) Copyright 2021 Remi Gau
this_path = fileparts(mfilename('fullpath'));
try
ft_defaults();
catch
try
if exist(fullfile(this_path, 'lib', 'fieldtrip'), 'dir')
addpath(fullfile(this_path, 'lib', 'fieldtrip'));
ft_defaults();
end
catch
error('Could not initialize FieldTrip. Is it in the Matlab path? Run "make install".');
end
end
paths_to_add = {
fullfile(this_path, 'src')
fullfile(this_path, 'lib', 'bids-matlab')
};
fprintf(1, '\nAdding to MATLAB path:');
for i = 1:size(paths_to_add, 1)
fprintf(1, '\n%s', paths_to_add{i});
addpath(paths_to_add{i});
end
fprintf(1, '\n\n');
end