-
Notifications
You must be signed in to change notification settings - Fork 1
/
startup.m
53 lines (46 loc) · 1.59 KB
/
startup.m
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
48
49
50
51
52
53
% Check if the script is running in a deployed (compiled) environment
% If so, skip the rest of the script as path additions are not necessary
if isdeployed
return
end
% Set a breakpoint for all errors - MATLAB will pause execution whenever an error occurs
dbstop if error
% Define the root directory for programming projects
%
rootProgramming = fullfile(root_programs, 'git', 'programming');
% List of packages to be added to MATLAB's path
% These are assumed to be subdirectories within the rootProgramming directory
pkgList = {...
'hydra-image-processor';
'matlab-utilities';
'direct-5D-viewer';
'vital-dyes';
'vhne';
'hmm-bayes';
'prototype';
'eric-sandbox';
'core'
};
% Call the function to add specified paths to MATLAB's search path
addPaths(rootProgramming, pkgList);
% Function to add paths
function addPaths(rootProgramming, pkgList)
% Subdirectory names within each package where MATLAB files are located
matlabDir = fullfile('src','MATLAB');
matlabDir_l = fullfile('src','matlab');
% Loop through each package in the list
for i = 1:length(pkgList)
% Construct the full path to the MATLAB directory in the package
pkgPath = fullfile(rootProgramming, pkgList{i}, matlabDir);
% Add the path if it exists
if exist(pkgPath, 'dir')
addpath(pkgPath);
else
% Check for an alternate path (lowercase 'matlab')
pkgPath = fullfile(rootProgramming, pkgList{i}, matlabDir_l);
if exist(pkgPath, 'dir')
addpath(pkgPath);
end
end
end
end