Skip to content

Commit de43389

Browse files
committed
add installMatlabPackageManager
1 parent f3d45b9 commit de43389

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
%% Download and install official Matlab Package Manger (mpm)
2+
% https://www.mathworks.com/help/install/ug/get-mpm-os-command-line.html
3+
4+
function pexe = installMatlabPackageManager(installDir)
5+
arguments
6+
installDir {mustBeTextScalar} = fileparts(mfilename('fullpath'))
7+
end
8+
9+
arch = computer('arch');
10+
11+
url = sprintf('https://www.mathworks.com/mpm/%s/mpm', arch);
12+
13+
exe = 'mpm';
14+
if ispc()
15+
exe = 'mpm.exe';
16+
end
17+
pexe = fullfile(installDir, exe);
18+
19+
pexe = websave(pexe, url);
20+
21+
fprintf("installed MPM %s\n", pexe);
22+
23+
% make the program executable
24+
if isunix()
25+
root = fileparts(fileparts(mfilename('fullpath')));
26+
addpath(root)
27+
assert(stdlib.set_permissions(pexe, 0, 0, 1), sprintf("chmod +x %s", pexe))
28+
end

0 commit comments

Comments
 (0)