ISVALID tests if the given miir has all the correct fields of the correct type. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ISVALID tests if the given miir has all the correct fields of the correct type. CALL: isvalid(miir); Returns 1 is miir is a valid MIIR-object; 0 otherwise. The following call returns a parameter list object that contains the default parameter values: >> pl = isvalid(miir, 'Params') The following call returns the cvs version number: >> ver = isvalid(miir, 'Version') The following call returns the category: >> ver = isvalid(miir, '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 miir has all the correct fields of the correct type. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: ISVALID tests if the given miir has all the correct fields of the 0007 % correct type. 0008 % 0009 % CALL: isvalid(miir); 0010 % 0011 % Returns 1 is miir is a valid MIIR-object; 0 otherwise. 0012 % 0013 % The following call returns a parameter list object that 0014 % contains the default parameter values: 0015 % >> pl = isvalid(miir, 'Params') 0016 % 0017 % The following call returns the cvs version number: 0018 % >> ver = isvalid(miir, 'Version') 0019 % 0020 % The following call returns the category: 0021 % >> ver = isvalid(miir, '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}, 'miir') && strcmp(varargin{2}, 'Params') 0037 varargout{1} = plist(); 0038 return 0039 elseif isa(varargin{1}, 'miir') && strcmp(varargin{2}, 'Version') 0040 varargout{1} = VERSION; 0041 return 0042 elseif isa(varargin{1}, 'miir') && 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}, 'miir') 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.b) && ... 0063 isnumeric (obj.gain) && ... 0064 isnumeric (obj.histin) && ... 0065 isnumeric (obj.histout) && ... 0066 ischar (obj.infile) && ... 0067 isa (obj.plist, 'plist') && ... 0068 ischar (obj.version) && ... 0069 isa (obj.created, 'time') 0070 0071 res(j) = 1; 0072 else 0073 res(j) = 0; 0074 end 0075 end 0076 0077 varargout{1} = res; 0078