0001 function pl = remove(pl, val)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 VERSION = '$Id: remove.m,v 1.5 2008/02/14 08:29:09 mauro Exp $';
0019 CATEGORY = 'Helper';
0020
0021
0022 if nargin == 2
0023 if isa(pl, 'plist') && strcmp(val, 'Params')
0024 pl = plist();
0025 return
0026 elseif isa(pl, 'plist') && strcmp(val, 'Version')
0027 pl = VERSION;
0028 return
0029 elseif isa(pl, 'plist') && strcmp(val, 'Category')
0030 pl = CATEGORY;
0031 return
0032 end
0033 end
0034
0035 np = nparams(pl);
0036 params = get(pl, 'params');
0037
0038
0039 if ischar(val)
0040 idx = [];
0041 for i=1:np
0042 key = get(params(i), 'key');
0043 if ~strcmpi(key, val)
0044 idx = [idx i];
0045 end
0046 end
0047 pl = plist(params(idx));
0048 if length(idx) == np
0049 warning('!!! No parameter found matching key name');
0050 end
0051
0052
0053 elseif isnumeric(val)
0054
0055 idx = [1:val-1 val+1:np];
0056 if max(idx)>np
0057 error('### index exceeds number of parameters');
0058 end
0059 pl = plist(params(idx));
0060
0061
0062 else
0063 error('### unknown indexing method')
0064 end
0065
0066
0067
0068