-
Notifications
You must be signed in to change notification settings - Fork 97
/
importmanopt.m
36 lines (32 loc) · 1.29 KB
/
importmanopt.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
function importmanopt()
% Add Manopt to the path to make all manopt components available.
% This file is part of Manopt: www.manopt.org.
% Original author: Nicolas Boumal, Jan. 3, 2013.
% Contributors:
% Change log:
% Aug. 7, 2013 (NB): Changed to work without the import command
% (new structure of the toolbox).
% Aug. 8, 2013 (NB): Changed to use addpath_recursive, home brewed.
% Aug. 22, 2013 (NB): Using genpath instead of home cooked
% addpath_recursive.
% Sep. 5, 2022 (NB): Added some safe-guards against pre-defined vars.
addpath(pwd());
% Recursively add Manopt directories to the Matlab path.
cd('manopt');
addpath(genpath(pwd()));
cd('..');
% Ask user if the path should be saved or not
fprintf('Manopt was added to Matlab''s path.\n');
response = input('Save path for future Matlab sessions? [Y/N] ', 's');
if strcmpi(response, 'Y')
failed = savepath();
if ~failed
fprintf('Path saved: no need to call importmanopt next time.\n');
else
fprintf(['Something went wrong.. Perhaps missing permission ' ...
'to write on pathdef.m?\nPath not saved: ' ...
'please re-call importmanopt next time.\n']);
end
else
fprintf('Path not saved: please re-call importmanopt next time.\n');
end