-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.startup_mexWholeBodyModel.m.in
70 lines (55 loc) · 2.22 KB
/
.startup_mexWholeBodyModel.m.in
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
%% startup_mexWholeBodyModel.m
% Run this script only once to permanently add the required folders for using mexWholebodymodel toolbox to your
% MATLAB path.
fprintf('\nmexWholeBodyModel Toolbox\n');
installDir = '@CMAKE_INSTALL_PREFIX@';
mexDir = [installDir, filesep, 'mex'];
mexWrapDir = [mexDir, filesep, 'mexwbi-wrappers'];
mexUtDir = [mexDir, filesep, 'mexwbi-utilities'];
if exist(mexDir, 'dir')
addpath(mexDir);
end
if exist(mexUtDir, 'dir')
addpath(mexUtDir);
end
if exist(mexWrapDir, 'dir')
addpath(mexWrapDir);
end
fileDir = userpath;
pathSeparatorLocation = strfind(fileDir, pathsep);
if isempty(fileDir)
answer=input('Empty userpath. Do you want mex-wholeBodyModel to reset the userpath for you? Y/N ','s');
if strcmp(answer,'Y')|| strcmp(answer,'y')
userpath('reset');
disp('Resetting userpath..');
fileDir = userpath;
else
error('Please set the userpath before running this script');
end
elseif size(pathSeparatorLocation, 2) > 1
answer=input('Multiple userpaths. Do you want mex-wholeBodyModel to reset the userpath for you? Y/N ','s');
if strcmp(answer,'Y')|| strcmp(answer,'y')
userpath('reset');
disp('Resetting userpath..');
fileDir = userpath;
else
error('Please set a single userpath before running this script');
end
end
pathSeparatorLocation = strfind(fileDir, pathsep);
if isempty(fileDir)
error('userpath is still empty. Please set the userpath before running this script');
elseif size(pathSeparatorLocation, 2) > 1
error('There are still userpaths. Please set a single userpath before running this script');
end
if (~isempty(pathSeparatorLocation))
fileDir(pathSeparatorLocation) = [];
end
fprintf('Saving paths to %s\n\n', [fileDir, filesep, 'pathdef.m']);
if (~savepath([fileDir, filesep, 'pathdef.m']))
fprintf(['A file called pathdef.m has been created in your %s folder.\n', ...
'This should be enough to permanentely add all the mexWholeBodyModel-Toolbox to ', ...
'your MATLAB installation.\n'], fileDir);
else
disp('There was an error generating pathdef.m To proceed please manually add the contents of variables mexDir, mexUtDir, mexWrapDir to your matlabpath');
end