-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathQUARTZ_setup.m
38 lines (33 loc) · 1.12 KB
/
QUARTZ_setup.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
function QUARTZ_setup(temporary)
% Add the directory containing this file, and its sub-directories, to the
% MATLAB path. If another QUARTZ.m is found somewhere on the MATLAB search
% path (i.e. another version of the software, or the same version stored
% elsewhere), it will be removed from the search path to avoid confusion.
%
% Input:
% TEMPORARY - TRUE if the path should not be saved (with a call to
% SETPATH), but rather only set for the current session (Default =
% FALSE).
%
%
% Copyright © 2013 Muhammad Moazam Fraz.
% See the file : Copyright.m for further details.
% Get the path of this file
pth = fileparts(mfilename('fullpath'));
% Check other versions of QUARTZ are somewhere on the search path, and remove
% them if so
arias = which('QUARTZ', '-all');
if ~isempty(arias)
for ii = 1:numel(arias)
arias_pth = fileparts(arias{ii});
if ~isequal(arias_pth, pth)
rmpath(genpath(arias_pth));
end
end
end
% Add to MATLAB path, along with subdirectories
addpath(genpath(pth));
% Save the path unless we only want this set up temporarily
if nargin < 1 || ~temporary
savepath;
end