ISFIELD tests if the given field is one of the object properties. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ISFIELD tests if the given field is one of the object properties. CALL: isfield(a, 'field'); The following call returns a parameter list object that contains the default parameter values: >> pl = isfield(zero, 'Params') The following call returns the cvs version number: >> ver = isfield(zero, 'Version') The following call returns the category: >> category = isfield(zero, 'Category') VERSION: $Id: isfield.m,v 1.4 2008/02/15 16:27:16 mauro Exp $ HISTORY: 25-09-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = isfield(varargin) 0002 0003 % ISFIELD tests if the given field is one of the object properties. 0004 % 0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0006 % 0007 % DESCRIPTION: ISFIELD tests if the given field is one of the object 0008 % properties. 0009 % 0010 % CALL: isfield(a, 'field'); 0011 % 0012 % The following call returns a parameter list object that 0013 % contains the default parameter values: 0014 % >> pl = isfield(zero, 'Params') 0015 % 0016 % The following call returns the cvs version number: 0017 % >> ver = isfield(zero, 'Version') 0018 % 0019 % The following call returns the category: 0020 % >> category = isfield(zero, 'Category') 0021 % 0022 % VERSION: $Id: isfield.m,v 1.4 2008/02/15 16:27:16 mauro Exp $ 0023 % 0024 % HISTORY: 25-09-07 M Hewitson 0025 % Creation 0026 % 0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0028 0029 VERSION = '$Id: isfield.m,v 1.4 2008/02/15 16:27:16 mauro Exp $'; 0030 CATEGORY = 'Helper'; 0031 0032 % 'Params' Call 0033 if nargin == 2 && isa(varargin{1}, 'zero') && ischar(varargin{2}) 0034 if strcmp(varargin{2}, 'Params') 0035 varargout{1} = plist(); 0036 return 0037 elseif strcmp(varargin{2}, 'Version') 0038 varargout{1} = VERSION; 0039 return 0040 elseif strcmp(varargin{2}, 'Category') 0041 varargout{1} = CATEGORY; 0042 return 0043 end 0044 end 0045 0046 as = []; 0047 field = ''; 0048 for j=1:nargin 0049 if isa(varargin{j}, 'zero') 0050 as = [as varargin{j}]; 0051 end 0052 if ischar(varargin{j}) 0053 field = varargin{j}; 0054 end 0055 end 0056 0057 res = zeros(size(as)); 0058 for j=1:numel(as) 0059 try 0060 t = as(j).(field); 0061 res(j) = 1; 0062 catch 0063 res(j) = 0; 0064 end 0065 end 0066 0067 varargout{1} = res; 0068