LTPDA_ISOBJECT checks that the input objects are one of the LTPDA object types. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: LTPDA_ISOBJECT checks that the input objects are one of the LTPDA object types. CALL: result = ltpda_isobject(a1) classes = ltpda_isobject() INPUTS: objects OUTPUTS: result == 1 if all input objects are LTPDA objects result == 0 otherwise classes - a list of recognised LTPDA object types VERSION: $Id: submit.m,v 1.14 2007/08/16 06:55:25 hewitson Exp $ HISTORY: 09-05-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = ltpda_isobject(varargin) 0002 0003 % LTPDA_ISOBJECT checks that the input objects are one of the LTPDA object 0004 % types. 0005 % 0006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0007 % 0008 % DESCRIPTION: LTPDA_ISOBJECT checks that the input objects are one of the LTPDA object 0009 % types. 0010 % 0011 % CALL: result = ltpda_isobject(a1) 0012 % classes = ltpda_isobject() 0013 % 0014 % INPUTS: objects 0015 % 0016 % OUTPUTS: result == 1 if all input objects are LTPDA objects 0017 % result == 0 otherwise 0018 % classes - a list of recognised LTPDA object types 0019 % 0020 % VERSION: $Id: submit.m,v 1.14 2007/08/16 06:55:25 hewitson Exp $ 0021 % 0022 % HISTORY: 09-05-07 M Hewitson 0023 % Creation 0024 % 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 0027 0028 if nargin == 0 0029 varargout{1} = classes; 0030 else 0031 0032 for j=1:nargin 0033 % check this object 0034 obj = varargin{1}; 0035 if iscell(obj) 0036 for k=1:length(obj) 0037 % check each one 0038 if ~isltpdaobj(obj{k}) 0039 varargout{1} = 0; 0040 return; 0041 end 0042 end 0043 else 0044 for k=1:length(obj) 0045 % check each one 0046 0047 % Stupid hack required because database objects can't cope with 0048 % begin indexed like conn(1) - all other objects work for this 0049 % call. 0050 if k==1 0051 if ~isltpdaobj(obj) 0052 varargout{1} = 0; 0053 return 0054 end 0055 else 0056 if ~isltpdaobj(obj(k)) 0057 varargout{1} = 0; 0058 return; 0059 end 0060 end 0061 end 0062 end 0063 end 0064 end 0065 0066 varargout{1} = 1; 0067 0068 %-------------------------------------------------------------------------- 0069 % Test a single object 0070 % 0071 function varargout = isltpdaobj(obj) 0072 0073 classes = {'ao',... 0074 'param',... 0075 'plist',... 0076 'cdata',... 0077 'tsdata',... 0078 'fsdata',... 0079 'xydata',... 0080 'specwin',... 0081 'mfir',... 0082 'miir',... 0083 'pzmodel',... 0084 'pole',... 0085 'zero',... 0086 'provenance',... 0087 'time',... 0088 'timeformat',... 0089 'timespan',... 0090 'history'}; 0091 0092 found = 0; 0093 for k=1:length(classes) 0094 type = classes{k}; 0095 if isa(obj, type) 0096 found = 1; 0097 end 0098 end 0099 if ~found 0100 varargout{1} = 0; 0101 return 0102 else 0103 varargout{1} = 1; 0104 end 0105