Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/fromPest.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 % FROMPEST Construct a AO from a pest. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % FUNCTION: FROMPEST Construct a AO from a pest | |
5 % | |
6 % DESCRIPTION: FROMPEST Construct a AO from a pest | |
7 % | |
8 % CALL: a = fromPest(a, pl) | |
9 % | |
10 % PARAMETER: pl: plist containing 'pest' | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 | |
14 function a = fromPest(a, pli) | |
15 | |
16 VERSION = '$Id: fromPest.m,v 1.5 2011/08/15 05:05:48 hewitson Exp $'; | |
17 | |
18 % get AO info | |
19 ii = ao.getInfo('ao', 'From Pest'); | |
20 | |
21 % Set the method version string in the minfo object | |
22 ii.setMversion([VERSION '-->' ii.mversion]); | |
23 | |
24 % Add default values | |
25 pl = applyDefaults(ii.plists, pli); | |
26 pl.getSetRandState(); | |
27 | |
28 ps = find(pl, 'pest'); | |
29 param_name = find(pl, 'parameter'); | |
30 | |
31 if isempty(param_name) | |
32 names = ps.names; | |
33 elseif isa(param_name, 'char') | |
34 names = {param_name}; | |
35 else | |
36 names = param_name; | |
37 end | |
38 a = ao.initObjectWithSize(1, numel(names)); | |
39 | |
40 for jj = 1:numel(names) | |
41 a(jj) = ps.find(names{jj}); | |
42 end | |
43 | |
44 if isempty(pl.find('name')) | |
45 pl.pset('name', names); | |
46 end | |
47 if isempty(pl.find('description')) | |
48 pl.pset('description', ps.description); | |
49 end | |
50 | |
51 % Add history | |
52 a.addHistory(ii, pl, [], ps.hist); | |
53 | |
54 % Set object properties from the plist | |
55 a.setObjectProperties(pl_set); | |
56 | |
57 end | |
58 | |
59 |