Home > classes > @ao > isvalid.m

isvalid

PURPOSE ^

ISVALID tests if the given ao has all the correct fields of the correct type.

SYNOPSIS ^

function varargout = isvalid(varargin)

DESCRIPTION ^

 ISVALID tests if the given ao has all the correct fields of the correct type.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: ISVALID tests if the given ao has all the correct fields of the 
              correct type.

 CALL:        isvalid(a);
 
              Returns 1 is a is a valid AO; 0 otherwise.

              The following call returns a parameter list object that
              contains the default parameter values:
              >> pl = isvalid(ao, 'Params')

              The following call returns the cvs version number:
              >> ver = isvalid(ao, 'Version')

 VERSION:     $Id: isvalid.m,v 1.3 2007/12/19 20:32:16 hewitson Exp $

 HISTORY: 25-09-07 M Hewitson
              Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = isvalid(varargin)
0002 
0003 % ISVALID tests if the given ao has all the correct fields of the correct type.
0004 %
0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0006 %
0007 % DESCRIPTION: ISVALID tests if the given ao has all the correct fields of the
0008 %              correct type.
0009 %
0010 % CALL:        isvalid(a);
0011 %
0012 %              Returns 1 is a is a valid AO; 0 otherwise.
0013 %
0014 %              The following call returns a parameter list object that
0015 %              contains the default parameter values:
0016 %              >> pl = isvalid(ao, 'Params')
0017 %
0018 %              The following call returns the cvs version number:
0019 %              >> ver = isvalid(ao, 'Version')
0020 %
0021 % VERSION:     $Id: isvalid.m,v 1.3 2007/12/19 20:32:16 hewitson Exp $
0022 %
0023 % HISTORY: 25-09-07 M Hewitson
0024 %              Creation
0025 %
0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0027 
0028 VERSION  = '$Id: isvalid.m,v 1.3 2007/12/19 20:32:16 hewitson Exp $';
0029 
0030 % 'Params' Call
0031 if nargin == 2
0032   if isa(varargin{1}, 'ao') && strcmp(varargin{2}, 'Params')
0033     varargout{1} = plist();
0034     return
0035   elseif isa(varargin{1}, 'ao') && strcmp(varargin{2}, 'Version')
0036     varargout{1} = VERSION;
0037     return
0038   end
0039 end
0040 
0041 as    = [];
0042 for j=1:nargin
0043   if isa(varargin{j}, 'ao')
0044     as = [as varargin{j}];
0045   end
0046 end
0047 
0048 res = zeros(size(as));
0049 for j=1:numel(as)
0050   a = as(j);
0051   if ischar(a.name) && ...
0052      isa(a.hist, 'history') && ...
0053      isa(a.provenance, 'provenance') && ...
0054      ischar(a.description) && ...
0055      iscell(a.mfile) && ...
0056      ischar(a.mfilename) && ...
0057      ischar(a.mdlfile) && ...
0058      ischar(a.mdlfilename) && ...
0059      ischar(a.version) && ...
0060      isa(a.created, 'time')
0061   
0062     res(j) = 1;
0063   else
0064     res(j) = 0;
0065   end
0066 end
0067 
0068 varargout{1} = res;
0069

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003