Home > classes > @plist > find.m

find

PURPOSE ^

FIND overloads find routine for a parameter list.

SYNOPSIS ^

function a = find(pl, key)

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 key 'key'.

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

 VERSION:     $Id: find.m,v 1.5 2007/12/12 18:45:08 ingo Exp $

 HISTORY:     02-02-2007 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function a = find(pl, key)
0002 % FIND overloads find routine for a parameter list.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: FIND overloads find routine for a parameter list.
0007 %              Returns the value corresponding to the first parameters in
0008 %              the list with key 'key'.
0009 %
0010 % CALL:        a = find(pl, 'key')
0011 %
0012 % VERSION:     $Id: find.m,v 1.5 2007/12/12 18:45:08 ingo Exp $
0013 %
0014 % HISTORY:     02-02-2007 M Hewitson
0015 %                 Creation
0016 %
0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0018 
0019 VERSION  = '$Id: find.m,v 1.5 2007/12/12 18:45:08 ingo Exp $';
0020 
0021 % Check if this is a call for parameters
0022 if nargin == 2
0023   if isa(pl, 'plist') && ischar(key)
0024     in = char(key);
0025     if strcmp(in, 'Params')
0026       a = plist;
0027       return
0028     elseif strcmp(in, 'Version')
0029       a = VERSION;
0030       return
0031     end
0032   end
0033 end
0034 
0035 ps = get(pl, 'params');
0036 np = length(ps);
0037 
0038 a = [];
0039 
0040 for i=1:np
0041   p = ps(i);
0042   if strcmpi(p.key, key)
0043     a = p.val;
0044     return
0045   end
0046 end
0047 
0048 
0049 
0050 % END

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003