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