-
Notifications
You must be signed in to change notification settings - Fork 2
/
Init3DMatlab.m
74 lines (57 loc) · 1.72 KB
/
Init3DMatlab.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% University of Bristol
% Department of Aerospace Engineering
% 2015
%
% Initialise work Flow
% Alexandre Payot
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function []=Init3DMatlab()
comStr=computer;
if strcmp(comStr(1:2),'PC')
else
clear all
setenv('TMP','/local/')
end
singleFolder={''};
rootTreeFolders={'SRCMAT'};
[addSingleDir]=FormulateValidFolders(singleFolder);
[rootTreeDirs]=FormulateValidFolders(rootTreeFolders);
[branchesDir]=ExploreFolderTree(rootTreeDirs);
addFolders=[addSingleDir,rootTreeDirs,branchesDir];
AddFoldersToPath(addFolders)
end
function [addFolders]=FormulateValidFolders(folders)
% adds a set of paths to the active path
addFolders={};
for ii=1:length(folders)
addFolders{ii}=[cd,filesep,folders{ii}];
end
end
function [addFolders]=ExploreFolderTree(rootDir)
% adds a set of paths to the active path
addFolders=rootDir;
for ii=1:length(rootDir)
dirinfo=dir(rootDir{ii});
dirNames={dirinfo([dirinfo(:).isdir]).name};
dirNames(1:2)=[];
if numel(dirNames)>0
branchDir={''};
for jj=1:length(dirNames)
branchDir{jj}=[rootDir{ii},filesep,dirNames{jj}];
end
[addSubFolders]=ExploreFolderTree(branchDir);
addFolders=[addFolders,addSubFolders];
end
end
end
function []=AddFoldersToPath(addFolders)
% adds a set of paths to the active path
newPaths=addFolders{1};
for ii=2:length(addFolders)
newPaths=[newPaths,pathsep,addFolders{ii}];
end
addpath(newPaths);
end