Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@ltpda_uo/getBuiltInModels.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,49 @@ +% GETBUILTINMODELS returns a list of the built-in AO models found on the +% system. +% +% CALL: ca = ao.getBuiltInModels +% +% OUTPUTS: +% ca - a cell-array of models. The first column is the model name; +% the second column is a description. +% +% M Hewitson 23-11-08 +% +% $Id: getBuiltInModels.m,v 1.3 2011/04/06 14:06:10 mauro Exp $ +% +function txt = getBuiltInModels(objName) + + paths = utils.models.getBuiltinModelSearchPaths(); + + for jj = 1:numel(paths) + utils.helper.msg(utils.const.msg.PROC1, 'looking for models in %s', paths{jj}); + end + + % list files in here + models = {}; + prefix = sprintf('%s_model_', objName); + NN = 7+length(objName); + for pp = 1:numel(paths) + files = utils.prog.filescan(paths{pp}, '.m'); + for ff = 1:numel(files) + parts = regexp(files{ff}, '(\.)*(\/)*', 'split'); + if strncmp(parts{end-1}, prefix, NN) + models = [models parts(end-1)]; + end + end + end + + % Give a list and an error if bsys is empty + txt = {}; + for k = 1:numel(models) + if strcmp(objName, 'ssm') + txt = [txt; models{k}(8+length(objName):end)]; + else + try + txt = [txt; {models{k}(8+length(objName):end), feval(models{k}, 'describe')}]; + catch + warning('LTPDA:MODEL:DESCRIPTION', '!!! The model "%s" fails for the description.', models{k}); + end + end + end +end