ISVALID tests if the given specwin has all the correct fields of the correct type. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: ISVALID tests if the given specwin has all the correct fields of the correct type. CALL: isvalid(specwin); Returns 1 is specwin is a valid SPECWIN-object; 0 otherwise. The following call returns a parameter list object that contains the default parameter values: >> pl = isvalid(specwin, 'Params') The following call returns the cvs version number: >> ver = isvalid(specwin, 'Version') The following call returns the category: >> ver = isvalid(specwin, 'Category') VERSION: $Id: isvalid.m,v 1.2 2008/02/17 18:45:56 hewitson Exp $ HISTORY: 14-02-2008 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = isvalid(varargin) 0002 % ISVALID tests if the given specwin has all the correct fields of the correct type. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: ISVALID tests if the given specwin has all the correct fields of the 0007 % correct type. 0008 % 0009 % CALL: isvalid(specwin); 0010 % 0011 % Returns 1 is specwin is a valid SPECWIN-object; 0 otherwise. 0012 % 0013 % The following call returns a parameter list object that 0014 % contains the default parameter values: 0015 % >> pl = isvalid(specwin, 'Params') 0016 % 0017 % The following call returns the cvs version number: 0018 % >> ver = isvalid(specwin, 'Version') 0019 % 0020 % The following call returns the category: 0021 % >> ver = isvalid(specwin, 'Category') 0022 % 0023 % VERSION: $Id: isvalid.m,v 1.2 2008/02/17 18:45:56 hewitson Exp $ 0024 % 0025 % HISTORY: 14-02-2008 Diepholz 0026 % Creation 0027 % 0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 0030 VERSION = '$Id: isvalid.m,v 1.2 2008/02/17 18:45:56 hewitson Exp $'; 0031 CATEGORY = 'Helper'; 0032 0033 % 'Params', 'Version', 'Category' Call 0034 0035 if nargin == 2 0036 if isa(varargin{1}, 'specwin') && strcmp(varargin{2}, 'Params') 0037 varargout{1} = plist(); 0038 return 0039 elseif isa(varargin{1}, 'specwin') && strcmp(varargin{2}, 'Version') 0040 varargout{1} = VERSION; 0041 return 0042 elseif isa(varargin{1}, 'specwin') && 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}, 'specwin') 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.alpha) && ... 0060 isnumeric (obj.psll) && ... 0061 isnumeric (obj.rov) && ... 0062 isnumeric (obj.nenbw) && ... 0063 isnumeric (obj.w3db) && ... 0064 isnumeric (obj.flatness) && ... 0065 isnumeric (obj.ws) && ... 0066 isnumeric (obj.ws2) && ... 0067 isnumeric (obj.win) && ... 0068 (isa (obj.plist, 'plist') || ... 0069 isempty(obj.plist)) && ... 0070 ischar (obj.version) && ... 0071 ischar (obj.created) 0072 % isa (obj.created, 'time') 0073 0074 res(j) = 1; 0075 else 0076 res(j) = 0; 0077 end 0078 end 0079 0080 varargout{1} = res; 0081