APPEND append a parameter to the parameter list. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: APPEND append a parameter to the parameter list. CALL : pl = append(pl,p); pl = append(pl,pl); pl = append(pl, 'key1', 'value1') pl = append(pl, 'key1', value1) VERSION: $Id: append.m,v 1.4 2007/07/18 13:58:45 ingo Exp $ HISTORY: 30-01-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function pl = append(pl, varargin) 0002 % APPEND append a parameter to the parameter list. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: APPEND append a parameter to the parameter list. 0007 % 0008 % CALL : pl = append(pl,p); 0009 % pl = append(pl,pl); 0010 % pl = append(pl, 'key1', 'value1') 0011 % pl = append(pl, 'key1', value1) 0012 % 0013 % VERSION: $Id: append.m,v 1.4 2007/07/18 13:58:45 ingo Exp $ 0014 % 0015 % HISTORY: 30-01-07 M Hewitson 0016 % Creation 0017 % 0018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0019 0020 params = []; 0021 argin = {}; 0022 0023 for ii = 1:nargin-1 0024 elem = varargin{ii}; 0025 0026 if isa(elem, 'param') 0027 params = [params, elem]; 0028 0029 elseif isa(elem, 'plist') 0030 params = [params, elem.params]; 0031 0032 else 0033 argin{end+1} = elem; 0034 end 0035 end 0036 0037 while length(argin) >= 2 0038 key = argin{1}; 0039 val = argin{2}; 0040 argin = argin(3:end); 0041 0042 if ~ischar(key) 0043 error('### the key ''%s'' must be a character string', key) 0044 end 0045 0046 params = [params param(key, val)]; 0047 end 0048 0049 pl.params = [pl.params params]; 0050 0051 % END