comparison m-toolbox/classes/@LTPDAworkbench/appendParam.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 % APPENDPARAM appends a parameter to the plist of the given block.
2 %
3 % CALL: wb.appendParam(blockname, param)
4 % wb.appendParam(blockname, 'key', value)
5 %
6 % M Hewitson 13-11-08
7 %
8 % $Id: appendParam.m,v 1.2 2010/08/06 19:10:48 ingo Exp $
9 %
10 function appendParam(wb, blockname, varargin)
11
12 % Parse input
13 if numel(varargin) == 1 && isa(varargin{1}, 'param')
14 pm = varargin{1};
15 elseif numel(varargin) == 2 && ischar(varargin{1})
16 pm = param(varargin{1}, varargin{2});
17 else
18 error('### Unknown inputs.');
19 end
20
21 % get the block with this name
22 b = awtinvoke(wb.mp, 'getBlockByName', blockname);
23
24 % Convert the plist to a java plist
25 pl = LTPDAworkbench.jpl2mpl(b.getPlist());
26 pl.append(pm);
27
28 % Convert the plist to a java plist
29 jpl = LTPDAworkbench.mpl2jpl(pl);
30
31 % set the plist
32 b.setPlist(jpl);
33 end