-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathaddOptickaToPath.m
More file actions
47 lines (39 loc) · 1.55 KB
/
addOptickaToPath.m
File metadata and controls
47 lines (39 loc) · 1.55 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
function addOptickaToPath()
% adds opticka to path, ignoring at least some of the unneeded folders
tt = tic;
mpath = path;
mpath = strsplit(mpath, pathsep);
opath = fileparts(mfilename('fullpath'));
%remove any old paths
opathesc = regexptranslate('escape',opath);
oldPath = ~cellfun(@isempty,regexpi(mpath,opathesc));
if any(oldPath)
rmpath(mpath{oldPath});
end
% add new paths
opaths = genpath(opath);
opaths = strsplit(opaths,pathsep);
sep = regexptranslate('escape',filesep);
pathExceptions = [".git" "adio" "arduino" "photodiode" "+uix" ...
"+zmq" "+uiextras" "legacy" "html" "doc" ".vscode"];
qAdd = contains(opaths,pathExceptions); % true where regexp _didn't_ match
addpath(opaths{~qAdd});
% Define the parent folder and the string array of optional project folder names
parentFolder = fileparts(opath); % Adjust this to your actual parent folder
folderNames = ["Palamedes" "CageLab/software" "matlab-jzmq", "matmoteGO", "PTBSimia"]; % Example folder names
% Loop through each folder name
for i = 1:length(folderNames)
% Construct the full path for each folder
folderPath = fullfile(parentFolder, folderNames(i));
% Check if the folder exists
if isfolder(folderPath)
% Add the folder to the MATLAB path
addpath(folderPath);
fprintf('Additionally added to path: %s\n', folderPath);
else
fprintf('Folder does not exist: %s\n', folderPath);
end
end
% Save the changes to the path for future sessions
savepath;
fprintf('--->>> Added opticka to the MATLAB path in %.1f ms...\n',toc(tt)*1000);