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.html,v 1.14 2008/03/31 10:27:42 hewitson Exp $ HISTORY: 02-02-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.html,v 1.14 2008/03/31 10:27:42 hewitson Exp $ 0013 % 0014 % HISTORY: 02-02-2007 M Hewitson 0015 % Creation 0016 % 0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0018 0019 VERSION = '$Id: find.html,v 1.14 2008/03/31 10:27:42 hewitson Exp $'; 0020 CATEGORY = 'Helper'; 0021 0022 % Check if this is a call for parameters 0023 if nargin == 2 0024 if isa(pl, 'plist') && ischar(key) 0025 in = char(key); 0026 if strcmp(in, 'Params') 0027 a = plist; 0028 return 0029 elseif strcmp(in, 'Version') 0030 a = VERSION; 0031 return 0032 elseif strcmp(in, 'Category') 0033 a = CATEGORY; 0034 return 0035 end 0036 end 0037 end 0038 0039 ps = get(pl, 'params'); 0040 np = length(ps); 0041 0042 a = []; 0043 0044 for i=1:np 0045 p = ps(i); 0046 if strcmpi(p.key, key) 0047 a = p.val; 0048 return 0049 end 0050 end 0051 0052 0053 0054 % END