


EQ overloads the == operator for fsdata objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: EQ overloads the == operator for fsdata objects.
All fields are checked.
CALL: result = eq(c1,c2)
result = eq(c1,c2, exc_list)
result = eq(c1,c2, 'property1', 'property2')
result = eq(c1,c2, 'class/property', 'class/property')
EXAMPLES: result = eq(c1,c2, 'name', 'created')
result = eq(c1,c2, 'ao/name')
INPUTS: c1,c2 - input fsdata objects
exc_list - exception list
List of properties which are not checked.
OUTPUTS: If the two fsdata objects are considered equal, result == 1,
otherwise, result == 0.
VERSION: $Id: eq.m,v 1.7 2007/11/27 12:15:40 ingo Exp $
HISTORY: 29-08-2007 M Hewitson
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0001 function result = eq(c1,c2, varargin) 0002 0003 % EQ overloads the == operator for fsdata objects. 0004 % 0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0006 % 0007 % DESCRIPTION: EQ overloads the == operator for fsdata objects. 0008 % 0009 % All fields are checked. 0010 % 0011 % CALL: result = eq(c1,c2) 0012 % result = eq(c1,c2, exc_list) 0013 % result = eq(c1,c2, 'property1', 'property2') 0014 % result = eq(c1,c2, 'class/property', 'class/property') 0015 % 0016 % EXAMPLES: result = eq(c1,c2, 'name', 'created') 0017 % result = eq(c1,c2, 'ao/name') 0018 % 0019 % INPUTS: c1,c2 - input fsdata objects 0020 % exc_list - exception list 0021 % List of properties which are not checked. 0022 % 0023 % OUTPUTS: If the two fsdata objects are considered equal, result == 1, 0024 % otherwise, result == 0. 0025 % 0026 % VERSION: $Id: eq.m,v 1.7 2007/11/27 12:15:40 ingo Exp $ 0027 % 0028 % HISTORY: 29-08-2007 M Hewitson 0029 % Creation 0030 % 0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0032 0033 VERSION = '$Id: eq.m,v 1.7 2007/11/27 12:15:40 ingo Exp $'; 0034 0035 % Check if this is a call for parameters 0036 if nargin == 2 0037 if isa(c1, 'fsdata') && ischar(c2) 0038 in = char(c2); 0039 if strcmp(in, 'Params') 0040 result = plist; 0041 return 0042 elseif strcmp(in, 'Version') 0043 result = VERSION; 0044 return 0045 end 0046 end 0047 end 0048 0049 result = 1; 0050 0051 %% Check class 0052 if ~strcmp(class(c1), class(c2)) 0053 result = 0; 0054 return 0055 end 0056 0057 fields = fieldnames(c1); 0058 0059 for ii = 1:length(fields) 0060 field = fields{ii}; 0061 0062 ck_field = {field, ['fsdata/' field]}; 0063 0064 %% Check tag 0065 if ~(any(ismember(ck_field, varargin))) 0066 0067 if isobject(c1.(field)) 0068 if ~eq(c1.(field), c2.(field), varargin{:}) 0069 result = 0; 0070 disp(sprintf('\nNOT EQUAL: %s.%s', class(c1), field)); 0071 return 0072 end 0073 else 0074 if ~isequalwithequalnans(c1.(field), c2.(field)) 0075 result = 0; 0076 disp(sprintf('\nNOT EQUAL: %s.%s', class(c1), field)); 0077 return 0078 end 0079 end 0080 0081 end 0082 end 0083 0084 0085 0086 % function result = eq(c1,c2, varargin) 0087 % 0088 % % EQ overloads the == operator for fsdata objects. 0089 % % 0090 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0091 % % 0092 % % DESCRIPTION: EQ overloads the == operator for fsdata objects. 0093 % % 0094 % % The 'name', 'fs', 'enbw', 'xunits, 'yunits, and data values are checked. 0095 % % 0096 % % CALL: result = eq(c1,c2) 0097 % % 0098 % % INPUTS: c1,c2 - input fsdata objects 0099 % % 0100 % % OUTPUTS: If the two fsdata objects are considered equal, result == 1, 0101 % % otherwise, result == 0. 0102 % % 0103 % % VERSION: $Id: eq.m,v 1.7 2007/11/27 12:15:40 ingo Exp $ 0104 % % 0105 % % HISTORY: 29-08-2007 M Hewitson 0106 % % Creation 0107 % % 0108 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0109 % 0110 % % Assume equality to begin with 0111 % result = 1; 0112 % 0113 % %% Check name 0114 % if ~ismember('name', varargin) 0115 % if ~strcmp(c1.name, c2.name) 0116 % result = 0; 0117 % return 0118 % end 0119 % end 0120 % 0121 % %% check fs 0122 % if ~ismember('fs', varargin) 0123 % if c1.fs ~= c2.fs 0124 % result = 0; 0125 % return 0126 % end 0127 % end 0128 % 0129 % %% check enbw 0130 % if ~ismember('enbw', varargin) 0131 % if c1.enbw ~= c2.enbw 0132 % result = 0; 0133 % return 0134 % end 0135 % end 0136 % 0137 % %% check xunits 0138 % if ~ismember('xunits', varargin) 0139 % if ~strcmp(c1.xunits, c2.xunits) 0140 % result = 0; 0141 % return 0142 % end 0143 % end 0144 % 0145 % %% check yunits 0146 % if ~ismember('yunits', varargin) 0147 % if ~strcmp(c1.yunits, c2.yunits) 0148 % result = 0; 0149 % return 0150 % end 0151 % end 0152 % 0153 % %% Check f data 0154 % if ~ismember('f', varargin) 0155 % if length(c1.f) ~= length(c2.f) 0156 % result = 0; 0157 % return 0158 % end 0159 % 0160 % if c1.f ~= c2.f 0161 % result = 0; 0162 % return 0163 % end 0164 % end 0165 % 0166 % %% Check xx data 0167 % if ~ismember('xx', varargin) 0168 % if length(c1.xx) ~= length(c2.xx) 0169 % result = 0; 0170 % return 0171 % end 0172 % 0173 % if c1.xx ~= c2.xx 0174 % result = 0; 0175 % return 0176 % end 0177 % end