


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(xydata, 'Params')
The following call returns the cvs version number:
>> ver = isfield(xydata, 'Version')
VERSION: $Id: isfield.m,v 1.2 2007/11/14 18:18:37 ingo Exp $
HISTORY: 25-09-07 M Hewitson
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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