-
Notifications
You must be signed in to change notification settings - Fork 10
/
gnsslab_install.m
47 lines (40 loc) · 1.1 KB
/
gnsslab_install.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
function gnsslab_install()
% INSTALL adds the necessary folders to the MATLAB path for the GNSSLAB
% toolbox to be used from anywhere.
%
% SYNTAX:
% >> GNSSLAB_INSTALL
%
% INPUT:
% none
%
% OUTPUT:
% none
%
% See also GNSSLAB_UNINSTALL, GENPATH, SAVEPATH, VER.
% Check the version
matlab = ver('MATLAB' );
if datenum( matlab.Date ) < datenum( '08-Jul-2011' )
fprintf('GNSSLab has been built and tested on MATLAB R2011b and above.\n');
fprintf('You are using an older version and may experience problems.\n' )
end
% Add the folders to the path
folder = fileparts( mfilename( 'fullpath' ) );
pathstr = genpath(folder);
seplocs = strfind(pathstr, pathsep);
loc1 = [1 seplocs(1:end-1)+1];
loc2 = seplocs(1:end)-1;
dirs = arrayfun(@(a,b) pathstr(a:b), loc1, loc2, 'UniformOutput', false);
for dd = 1:numel( dirs )
addpath( dirs{dd} );
fprintf( '+ Folder added to path: %s\n', dirs{dd} );
end
% Save the changes to make the installation permanent
if savepath() == 0
% Success
fprintf( 'GNSSLab installed\n' );
else
% Failure
fprintf( 'Failed to add GNSSLab to the MATLAB path\n' );
end
end