0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % GETBUILTINMODELS returns a list of the built-in AO models found on the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 % system.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % CALL: ca = ao.getBuiltInModels
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % OUTPUTS:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % ca - a cell-array of models. The first column is the model name;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % the second column is a description.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % M Hewitson 23-11-08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % $Id: getBuiltInModels.m,v 1.3 2011/04/06 14:06:10 mauro Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 function txt = getBuiltInModels(objName)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 paths = utils.models.getBuiltinModelSearchPaths();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 for jj = 1:numel(paths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 utils.helper.msg(utils.const.msg.PROC1, 'looking for models in %s', paths{jj});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % list files in here
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 models = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 prefix = sprintf('%s_model_', objName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 NN = 7+length(objName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 for pp = 1:numel(paths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 files = utils.prog.filescan(paths{pp}, '.m');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 for ff = 1:numel(files)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 parts = regexp(files{ff}, '(\.)*(\/)*', 'split');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 if strncmp(parts{end-1}, prefix, NN)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 models = [models parts(end-1)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % Give a list and an error if bsys is empty
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 txt = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 for k = 1:numel(models)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 if strcmp(objName, 'ssm')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 txt = [txt; models{k}(8+length(objName):end)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 txt = [txt; {models{k}(8+length(objName):end), feval(models{k}, 'describe')}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 warning('LTPDA:MODEL:DESCRIPTION', '!!! The model "%s" fails for the description.', models{k});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 end
|