0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % MAKETOOLBOX Create the toolbox 'ltpda'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: MAKETOOLBOX Create the toolbox 'ltpda'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % This script will package together all files into a toolbox that
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % can be distributed for various OS's.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % CALL: makeToolbox
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % VERSION: $Id: makeToolbox.m,v 1.182 2011/05/18 06:48:07 hewitson Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % HISTORY: 30-01-07 M Hewitson
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % Creation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 function varargout = makeToolbox(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 %% Some clearing
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 % remove the user preferences
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 setappdata(0, 'LTPDApreferences', '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 % now clear everything
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 evalin('base', 'clear');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 %% Settings
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 % install toolbox to this directory
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 if nargin == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 rootdir = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 rootdir = '/Users/hewitson/working/matlab';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % compile options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 closedSource = 0; % 1 => compile all .m files to .p files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 read_only = 0; % Make all installed files read-only? (except ltpda_startup.m)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % copy the help files to the installed toolbox
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 install_help = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 % install the examples and tests
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 install_examples = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % Run the python script to build the html help
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 build_help = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 % build the documentation search database
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 build_doc_search = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 % build the page of functions by category,
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 build_functions_by_category = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 % rebuild workbench library
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 rebuild_workbench_library = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 % set version for the Contents.m and for packaging
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 ltpda_ver = '2.4.dev';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 %% ------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % -------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 % -------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 % -------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 % Should not need to edit below here
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 % -------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 % -------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 % -------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 % -------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 mpipelineSrc = 'MPipeline2';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 makeDoc = 0; % make html doc for all m files using m2html, ref: http://www.artefact.tk/software/matlab/m2html/
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 % build version string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 mver = ver('MATLAB');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 ltpda_version = sprintf('%s %s %s', ltpda_ver, mver.Release, datestr(now, 'dd-mm-yy'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 % build OS target directory
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 toolboxRoot = fullfile(rootdir, 'ltpda_toolbox');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 % remove toolbox from matlab path
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 rmpath(genpath(toolboxRoot));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 savepath;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 rehash toolboxcache;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 % delete old toolbox
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 if exist(toolboxRoot, 'dir')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 rmdir(toolboxRoot, 's');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 % create toolbox root
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 mkdir(toolboxRoot);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 % create toolbox dir
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 toolboxDir = fullfile(rootdir, sprintf('ltpda_toolbox'), 'ltpda');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 mkdir(toolboxDir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 %% Install latest jar files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 % MPipeline
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 copyfile(fullfile('..', 'src', mpipelineSrc, 'dist', [mpipelineSrc '.jar']), fullfile('jar', 'MPipeline.jar'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 ddir = fullfile('jar', 'lib');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 if ~exist(ddir, 'dir')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 mkdir(ddir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 copyfile(fullfile('..','src',mpipelineSrc,'dist','lib'), ddir, 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 % login dialog
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 copyfile(fullfile('..', 'src', 'LoginDialog', 'dist', 'LoginDialog.jar'), fullfile('jar', 'LoginDialog.jar'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 mkdir(toolboxDir, 'jar');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 jars = dir('jar');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 for c = 1:numel(jars)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 s = jars(c);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 [path, name, ext] = fileparts(s.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 if strcmp(ext, '.jar')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 copyfile(fullfile('jar', s.name), fullfile(toolboxDir, 'jar'), 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 % Also the lib dir for MPipeline
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 mkdir(toolboxDir, fullfile('jar', 'lib'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 copyfile(fullfile('jar', 'lib'), fullfile(toolboxDir, 'jar', 'lib'), 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 %% copy m files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 srcs = {'m/etc/', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 'm/gui', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 'm/helper', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 'm/sigproc',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 'm/built_in_models'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 mkdir(toolboxDir, 'm');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 for s=srcs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 copyfile(char(s), fullfile(toolboxDir, char(s)), 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 % Copy some other files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 copyfile('m/MakeContents.m', toolboxDir, 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 %% install classes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 classes = {'ltpda_obj', 'ltpda_nuo', 'ltpda_uo', 'ltpda_uoh', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 'minfo', 'unit', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 'pz', 'pzmodel', 'rational', 'parfrac',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 'ltpda_tf', 'ltpda_filter', 'miir', 'mfir', 'filterbank', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 'ltpda_data', 'data2D', 'data3D', 'tsdata', 'cdata', 'xydata', 'fsdata', 'xyzdata', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 'provenance', 'history', 'param', 'paramValue', 'plist',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 'ao', 'specwin', 'time', 'timespan',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 'pest', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 'ssm', 'ssmport', 'ssmblock', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 'smodel', 'msym', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 'sigBuilder', 'constructor', 'specwinViewer', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 'LTPDAprefs', 'LTPDAworkbench', 'LTPDARepositoryManager', 'workspaceBrowser', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 'LTPDAModelBrowser', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 'matrix', 'collection', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 };
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 % 'LTPDAHelper'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 % 'stattest', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 % 'plotter', 'plotterFactory', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 % 'aoplotter', 'tsplotter' ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 for c = classes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 cdir = fullfile('classes', sprintf('@%s', char(c)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 mkdir(toolboxDir, cdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 copyfile(cdir, fullfile(toolboxDir, cdir), 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 %% install unit tests
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 cdir = fullfile('classes', 'tests');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 mkdir(toolboxDir, cdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 copyfile(cdir, fullfile(toolboxDir, cdir), 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 %% install packages
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 pkgs = { 'utils'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 for c = pkgs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 cdir = fullfile('classes', sprintf('+%s', char(c)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 mkdir(toolboxDir, cdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 copyfile(cdir, fullfile(toolboxDir, cdir), 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 %% Install mex src files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 srcs = {'c_sources', 'ltpda_dft', 'ltpda_smoother', 'ltpda_polyreg', 'ltpda_ssmsim'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 for c = srcs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 cdir = fullfile('src', char(c));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 mkdir(toolboxDir, cdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 copyfile(fullfile('../', cdir), fullfile(toolboxDir, cdir), 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 % Copy compileAll.m
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 copyfile('../src/compileAll.m', fullfile(toolboxDir, 'src'), 'f')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 copyfile('../src/vcredist_x86.exe', fullfile(toolboxDir, 'src'), 'f')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 copyfile('../src/vcredist_x64.exe', fullfile(toolboxDir, 'src'), 'f')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 %% Now build examples directory in toolbox
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 if install_examples
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 % load list of tests to install
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 run 'test/test_list.m';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 mkdir(toolboxDir, 'examples');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 installPoint = fullfile(toolboxDir, 'examples');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 for f = 1:length(test_struct)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 if test_struct(f).example
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 disp(sprintf(' - installing %s', test_struct(f).name));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 copyfile(fullfile('test', [test_struct(f).name '.m']), installPoint);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 % Some additional files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 copyfile(fullfile('test', 'test_list.m'), installPoint);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 copyfile(fullfile('test', 'run_tests.m'), installPoint);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 copyfile(fullfile('test', 'make_test_ascii_file.m'), installPoint);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 mkdir(installPoint, 'pipelines');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 copyfile(fullfile('test', 'pipelines'), fullfile(installPoint, 'pipelines'), 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 %% Clean up
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 % Remove recursive the CVS directories in toolboxDir
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 rm_cvs_dir(toolboxRoot, 'CVS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 rm_cvs_dir(toolboxRoot, '*.m~');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 rm_cvs_dir(toolboxRoot, '.#ltpda*');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 % add toolbox to matlab path
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 addpath(genpath(toolboxRoot));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 %% Now build Contents.m files and documentation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 cdir = pwd;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 cd(toolboxDir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 MakeContents('LTPDA', ltpda_version);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 cd(cdir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 if makeDoc
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 % Build doc list
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 docs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 for jj = 1:length(classes)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 docs = [docs cellstr(['classes/@' classes{jj}])];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 for jj = 1:length(srcs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 if ~strcmp(srcs{j}, 'mex')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 docs = [docs cellstr(srcs{jj})];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 % build documentation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 m2html('mfiles', docs,...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 'htmldir', 'html_help/help/ug',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 'recursive', 'on',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 'template', 'docstyle',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 'indexFile', 'mindex');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 if build_help
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 % Make on-line html TOC
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 cd html_help/help
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 convertTOC
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 % try to generate html codes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 [temp pythonVer] = system('python -V');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 pythonVer = strtok(pythonVer,'Python ');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 if numel(pythonVer)>3, pythonVer(4:end)=[]; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 pythonVer = str2double(pythonVer);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 if isnan(pythonVer)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 error('*** Failed check of Python version');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 elseif pythonVer > 2.6
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 !python ./mkhelpfiles_v3.py -i helptoc.xml
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 !python ./mkhelpfiles.py -i helptoc.xml
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 catch ME
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 warning('!!! Couldn''t run mkhelpfiles.py. Do you have python installed?');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 cd(cdir)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 % Now copy the help files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 if install_help
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 status = copyfile('html_help/help', fullfile(toolboxDir,'help'), 'f')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 copyfile('html_help/info.xml', toolboxDir, 'f');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 addpath(fullfile(toolboxDir, 'help', 'ug'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 delete(fullfile(toolboxDir,'help','ug', '*_content.html'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 % Now build search index
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 if build_doc_search
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 builddocsearchdb(fullfile(toolboxDir, 'help'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 % Now everything is copied so we can save the path.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 savepath;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 rehash toolboxcache;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 %% Build functions by category
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 if build_functions_by_category
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 disp('%% running mk_functions_by_category %%');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 mk_functions_by_category;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 %% Make all files read-only
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 if read_only
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 files = mtfilescan(toolboxRoot);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 for jj = 1:length(files)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 fi = files{jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 [path,name,ext] = fileparts(fi);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 if ~strcmp(name, 'ltpda_startup')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 if ispc
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 [success, message, messageid] = fileattrib(fi, '-w');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 [success, message, messageid] = fileattrib(fi, '-w', 'a');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 if ~success
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 warning('!!! Failed to set attributes for %s', fi);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 %% Now compile all .m files and remove if necessary
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 if closedSource
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 mfiles = mtfilescan(toolboxDir, '.m');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 for ii = 1:length(mfiles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 f = char(mfiles(ii));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 pcode(f, '-inplace');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 writeHelpMfile(f)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 %% Now clean up
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 % Remove recursive the CVS directories in toolboxDir
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 rm_cvs_dir(toolboxRoot, 'CVS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 rm_cvs_dir(toolboxRoot, '*.m~');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 rm_cvs_dir(toolboxRoot, '.#ltpda*');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 rehash;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 rehash toolboxcache;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 ltpda_startup;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 if rebuild_workbench_library
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 lib = LTPDAworkbench.rebuildLibrary;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 save(fullfile(toolboxRoot, 'ltpda', 'classes', '@LTPDAworkbench', 'lib.mat'), 'lib')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 function writeHelpMfile(mfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 % This replaces an m-file with another m-file that contains only the help
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 % of the original one
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 % get the help
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 [pathstr,name,ext] = fileparts(mfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 h = help(name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 disp(sprintf('** Writing help m-file for %s', name));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 fd = fopen(mfile, 'w+');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 fprintf(fd, '%s', h);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 function files = mtfilescan(root_dir, ext)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 % Recursively scans the given directory for files that end in
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 % 'ext' and returns a list of the full paths.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 if nargin < 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 ext = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 files = getfiles(root_dir, ext, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 function ofiles = getfiles(root_dir, iext, ofiles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 % Recursive function for getting file lists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 files = dir(root_dir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 for jj = 1:length(files)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 f = files(jj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 if f.isdir
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 if ~strcmp(f.name,'.') && ~strcmp(f.name,'..')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 ofiles = getfiles([root_dir '/' f.name], iext, ofiles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 [pathstr,name,ext] = fileparts(f.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 if ~isempty(iext)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 if any(strcmp(ext, iext))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 ofiles = [ofiles; cellstr([root_dir '/' f.name])];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 ofiles = [ofiles; cellstr([root_dir '/' f.name])];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 % END
|