Home > classes > @plist > find.m

find

PURPOSE ^

FIND overloads find routine for a parameter list.

SYNOPSIS ^

function varargout = find(varargin)

DESCRIPTION ^

 FIND overloads find routine for a parameter list.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: FIND overloads find routine for a parameter list.
              Returns the value corresponding to the first parameters in
              the list with the search-key.

 CALL:        a = find(pl, 'key')

 M-FILE INFO: Get information about this methods by calling
              >> plist.getInfo('find')

              Get information about a specified set-plist by calling:
              >> plist.getInfo('find', 'set')

 VERSION:     $Id: find.m,v 1.13 2008/09/04 15:29:31 ingo Exp $

 HISTORY:     02-02-2007 M Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

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

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003