1 | function installToolbox
|
---|
2 | % configure MATLAB paths for the Telops Toolbox.
|
---|
3 | % installToolbox
|
---|
4 | %
|
---|
5 | % Drop this file into MATLAB command line window. It will configure the
|
---|
6 | % required paths to run with the Telops Toolbox.
|
---|
7 |
|
---|
8 | % moveright Telops 2009
|
---|
9 | % $Revision: 9106 $
|
---|
10 | % $Author: ssavary $
|
---|
11 | % $LastChangedDate: 2014-11-03 14:16:48 -0500 (lun., 03 nov. 2014) $
|
---|
12 | if ~exist('readIRCam.p','file')
|
---|
13 | if ~exist('Library_IRCAM','dir')
|
---|
14 | unzip('Library_IRCAM.zip')
|
---|
15 | disp('Library_IRCAM created')
|
---|
16 | end
|
---|
17 | root = fileparts(mfilename('fullpath'));
|
---|
18 |
|
---|
19 | D = [{root}; extractSubTree(root)];
|
---|
20 |
|
---|
21 | v2007_exceptions = {'GUILayout'};
|
---|
22 | exceptions = {'Documentation', 'ReleasePackages'};
|
---|
23 |
|
---|
24 | disp('installToolbox: Installing Toolbox...')
|
---|
25 | disp('installToolbox: Adding directories to the MATLAB path:')
|
---|
26 |
|
---|
27 | V = ver('matlab');
|
---|
28 | for ii=1:length(D)
|
---|
29 | if ~isempty(V) && (str2double(V.Version(1)) == 7 && str2double(V.Version(3:end)) < 10) && ...
|
---|
30 | any(arrayfun(@(x)~isempty(strfind(D{ii},x{1})), v2007_exceptions)) || ...
|
---|
31 | any(arrayfun(@(x)~isempty(strfind(D{ii},x{1})), exceptions)) || ...
|
---|
32 | any(D{ii} == '+')
|
---|
33 | else
|
---|
34 | disp(['path ' D{ii} ' added'])
|
---|
35 | addpath(D{ii})
|
---|
36 | end
|
---|
37 | end
|
---|
38 |
|
---|
39 | disp('installToolbox: Installation complete.')
|
---|
40 | end
|
---|
41 |
|
---|
42 |
|
---|
43 | function D = extractSubTree(root)
|
---|
44 | % Recursively build the list of subdirectories under 'root'.
|
---|
45 | % extractSubTree
|
---|
46 | %
|
---|
47 |
|
---|
48 | DD = dir(root);
|
---|
49 |
|
---|
50 | idx = find([DD.isdir]);
|
---|
51 | D = [];
|
---|
52 | for ii=idx
|
---|
53 | if strncmp(DD(ii).name,'.',1)==0 && isempty(strfind(DD(ii).name,'@')) && isempty(strfind(DD(ii).name,'private'))
|
---|
54 | % skip '.', '..', and invisible folders
|
---|
55 | subdir = fullfile(root, DD(ii).name);
|
---|
56 | D = [D; {subdir}; extractSubTree(subdir)]; %#ok<AGROW>
|
---|
57 | end
|
---|
58 | end |
---|