Master Thesis Code
by Simon Moser
Loading...
Searching...
No Matches
repoStartup.m
Go to the documentation of this file.
1% For LICENSE / TERMS OF USE, see the file LICENSE in the root directory of the repository.
2
3% add folders and subfolders to the path
4recursiveAddPath("classes");
5recursiveAddPath("examples");
6recursiveAddPath("experiments");
7recursiveAddPath("functions");
8recursiveAddPath("tools");
9
10% add the path to the savepath
11savepath;
12
13
14
15% function to add folders and subfolders to the path recursively
16function recursiveAddPath(path)
17
18 % check if the path is already in the path (also in the temporary path)
19 if contains(path, pathdef)
20 toAdd = false;
21 else
22 toAdd = true;
23 end
24
25 % check for hidden folders
26 if contains(path, ".")
27 toAdd = false;
28 end
29
30 % add the path to the path
31 if toAdd
32 addpath(genpath(path));
33 end
34
35 % get the subfolders of the current folder
36 folders = dir(path);
37 folders = folders([folders.isdir]);
38
39 % display a message if the path was added
40 if toAdd
41 disp("Added " + folders(1).folder + " to the path.");
42 end
43
44 % recursively add subfolders to the path
45 for i = 1:length(folders)
46 if ~strcmp(folders(i).name, ".") && ~strcmp(folders(i).name, "..")
47 recursiveAddPath(fullfile(path, folders(i).name));
48 end
49 end
50end
function recursiveAddPath(in path)