-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup_bMSd.m
73 lines (65 loc) · 1.59 KB
/
setup_bMSd.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
function setup_bMSd(case_flag)
%
% ------------------------------------------------------
% | Basic Multibody Simulator Derived (Matlab toolbox) |
% ------------------------------------------------------
%
% setup_brd
%
% Add (remove) bMSd Toolbox to (from) the Matlab path
%
% Syntax:
% -------
% setup_brd % case_flag = 1 is assumed
% setup_brd(case_flag)
%
% Input:
% ------
% case_flag - if case_flag == 1 add bMSd to the Matlab path
% if case_flag ~= 1 remove bMSd from the Matlab path
%
% Note:
% -------
% Under LINUX the savepath command issues an error (when the user permissions are not sufficient)
% chmod: changing permissions of `/usr/local/Matlab2007a/toolbox/local/pathdef.m': Operation not permitted
%
% One can change the permissions of pathdef.m by doing:
% cd path_to_Matlab/toolbox/local/
% sudo chmod 777 pathdef.m
% User input (add directories)
% ------------------------
d{1} = 'rotation';
d{2} = 'kinematics';
d{3} = 'dynamics';
d{4} = 'general_purpose';
d{5} = 'models';
d{6} = 'solvers';
%d{7} = 'examples';
% ------------------------
if nargin == 0
case_flag = 1;
end
if isunix
slash_str = '/';
elseif ispc
slash_str = '\';
else
disp('ERROR: Unkonwn computer type')
return
end
cdir = pwd;
if case_flag == 1 % add to the path
for i=1:length(d)
path([cdir slash_str d{i}], path);
end
else % remove from the path
for i=1:length(d)
rmpath([cdir slash_str d{i}])
end
end
% save the path
s = savepath;
if s
disp('ERROR: the path could not be saved')
end
%%%EOF