ISPARAM look for a given key in the parameter lists. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ISPARAM look for a given key in the parameter lists. Exist the key in the parameter list then is the result 1 otherwise 0. The output size have the same numer as the numer of the input plists. CALL: res = isparam(pl, 'key') res = isparam(pl1, pl2, 'key') M-FILE INFO: Get information about this methods by calling >> plist.getInfo('isparam') Get information about a specified set-plist by calling: >> plist.getInfo('isparam', 'set') VERSION: $Id: isparam.m,v 1.9 2008/09/04 15:29:31 ingo Exp $ HISTORY: 07-11-2007 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % ISPARAM look for a given key in the parameter lists. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: ISPARAM look for a given key in the parameter lists. Exist the key 0005 % in the parameter list then is the result 1 otherwise 0. 0006 % The output size have the same numer as the numer of the input 0007 % plists. 0008 % 0009 % CALL: res = isparam(pl, 'key') 0010 % res = isparam(pl1, pl2, 'key') 0011 % 0012 % M-FILE INFO: Get information about this methods by calling 0013 % >> plist.getInfo('isparam') 0014 % 0015 % Get information about a specified set-plist by calling: 0016 % >> plist.getInfo('isparam', 'set') 0017 % 0018 % VERSION: $Id: isparam.m,v 1.9 2008/09/04 15:29:31 ingo Exp $ 0019 % 0020 % HISTORY: 07-11-2007 Diepholz 0021 % Creation 0022 % 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 0025 function varargout = isparam(varargin) 0026 0027 %%% Check if this is a call for parameters 0028 if utils.helper.isinfocall(varargin{:}) 0029 varargout{1} = getInfo(varargin{3}); 0030 return 0031 end 0032 0033 [objs, invars, rest] = utils.helper.collect_objects(varargin(:), 'plist'); 0034 0035 %%%%%%%%%% Some plausibility checks %%%%%%%%%% 0036 if numel(rest) ~= 1 0037 error('### Please specify only one ''key''.'); 0038 end 0039 0040 if ~ischar(rest{1}) 0041 error('### The ''key'' must be a string but it is from the class %s.', class(rest{1})); 0042 end 0043 0044 res = zeros(size(objs)); 0045 key = rest{1}; 0046 0047 for ii = 1:numel(objs) 0048 0049 pl = objs(ii); 0050 0051 for jj = 1:length(pl.params) 0052 if strcmpi(pl.params(jj).key, key) 0053 res(ii) = 1; 0054 break 0055 end 0056 end 0057 end 0058 0059 varargout{1} = res; 0060 end 0061 0062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0063 % Local Functions % 0064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0065 0066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0067 % 0068 % FUNCTION: getInfo 0069 % 0070 % DESCRIPTION: Get Info Object 0071 % 0072 % HISTORY: 11-07-07 M Hewitson 0073 % Creation. 0074 % 0075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0076 0077 function ii = getInfo(varargin) 0078 if nargin == 1 && strcmpi(varargin{1}, 'None') 0079 sets = {}; 0080 pl = []; 0081 else 0082 sets = {'Default'}; 0083 pl = getDefaultPlist; 0084 end 0085 % Build info object 0086 ii = minfo(mfilename, 'plist', '', utils.const.categories.helper, '$Id: isparam.m,v 1.9 2008/09/04 15:29:31 ingo Exp $', sets, pl); 0087 end 0088 0089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0090 % 0091 % FUNCTION: getDefaultPlist 0092 % 0093 % DESCRIPTION: Get Default Plist 0094 % 0095 % HISTORY: 11-07-07 M Hewitson 0096 % Creation. 0097 % 0098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0099 0100 function plo = getDefaultPlist() 0101 plo = plist(); 0102 end 0103