ISVALID tests if the given mfir has all the correct fields of the correct type. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ISVALID tests if the given mfir has all the correct fields of the correct type. CALL: isvalid(mfir); Returns 1 is mfir is a valid MFIR-object; 0 otherwise. The following call returns a parameter list object that contains the default parameter values: >> pl = isvalid(mfir, 'Params') The following call returns the cvs version number: >> ver = isvalid(mfir, 'Version') The following call returns the category: >> ver = isvalid(mfir, 'Category') VERSION: $Id: isvalid.m,v 1.2 2008/02/15 17:36:45 ingo Exp $ HISTORY: 14-02-2008 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = isvalid(varargin) 0002 % ISVALID tests if the given mfir has all the correct fields of the correct type. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: ISVALID tests if the given mfir has all the correct fields of the 0007 % correct type. 0008 % 0009 % CALL: isvalid(mfir); 0010 % 0011 % Returns 1 is mfir is a valid MFIR-object; 0 otherwise. 0012 % 0013 % The following call returns a parameter list object that 0014 % contains the default parameter values: 0015 % >> pl = isvalid(mfir, 'Params') 0016 % 0017 % The following call returns the cvs version number: 0018 % >> ver = isvalid(mfir, 'Version') 0019 % 0020 % The following call returns the category: 0021 % >> ver = isvalid(mfir, 'Category') 0022 % 0023 % VERSION: $Id: isvalid.m,v 1.2 2008/02/15 17:36:45 ingo Exp $ 0024 % 0025 % HISTORY: 14-02-2008 Diepholz 0026 % Creation 0027 % 0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 0030 VERSION = '$Id: isvalid.m,v 1.2 2008/02/15 17:36:45 ingo Exp $'; 0031 CATEGORY = 'Helper'; 0032 0033 % 'Params', 'Version', 'Category' Call 0034 0035 if nargin == 2 0036 if isa(varargin{1}, 'mfir') && strcmp(varargin{2}, 'Params') 0037 varargout{1} = plist(); 0038 return 0039 elseif isa(varargin{1}, 'mfir') && strcmp(varargin{2}, 'Version') 0040 varargout{1} = VERSION; 0041 return 0042 elseif isa(varargin{1}, 'mfir') && strcmp(varargin{2}, 'Category') 0043 varargout{1} = CATEGORY; 0044 return 0045 end 0046 end 0047 0048 objs = []; 0049 for j=1:nargin 0050 if isa(varargin{j}, 'mfir') 0051 objs = [objs varargin{j}]; 0052 end 0053 end 0054 0055 res = zeros(size(objs)); 0056 for j=1:numel(objs) 0057 obj = objs(j); 0058 if ischar (obj.name) && ... 0059 isnumeric (obj.fs) && ... 0060 isnumeric (obj.ntaps) && ... 0061 isnumeric (obj.a) && ... 0062 isnumeric (obj.gd) && ... 0063 isnumeric (obj.gain) && ... 0064 isnumeric (obj.histout) && ... 0065 ischar (obj.infile) && ... 0066 isa (obj.plist, 'plist') && ... 0067 ischar (obj.version) && ... 0068 isa (obj.created, 'time') 0069 0070 res(j) = 1; 0071 else 0072 res(j) = 0; 0073 end 0074 end 0075 0076 varargout{1} = res; 0077