EQ overloads the == operator for cdata objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: EQ overloads the == operator for cdata objects. The 'name' and data values are checked. CALL: result = eq(c1,c2) INPUTS: c1,c2 - input cdata objects OUTPUTS: If the two cdata objects are considered equal, result == 1, otherwise, result == 0. VERSION: $Id: param.m,v 1.7 2007/08/17 11:22:11 ingo Exp $ HISTORY: 29-08-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function result = eq(c1,c2) 0002 0003 % EQ overloads the == operator for cdata objects. 0004 % 0005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0006 % 0007 % DESCRIPTION: EQ overloads the == operator for cdata objects. 0008 % 0009 % The 'name' and data values are checked. 0010 % 0011 % CALL: result = eq(c1,c2) 0012 % 0013 % INPUTS: c1,c2 - input cdata objects 0014 % 0015 % OUTPUTS: If the two cdata objects are considered equal, result == 1, 0016 % otherwise, result == 0. 0017 % 0018 % VERSION: $Id: param.m,v 1.7 2007/08/17 11:22:11 ingo Exp $ 0019 % 0020 % HISTORY: 29-08-2007 M Hewitson 0021 % Creation 0022 % 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 0025 % Assume equality to begin with 0026 result = 1; 0027 0028 %% Check name 0029 if ~strcmp(c1.name, c2.name) 0030 result = 0; 0031 return 0032 end 0033 0034 %% Check vals 0035 if length(c1.vals) ~= length(c2.vals) 0036 result = 0; 0037 return 0038 end 0039 0040 if c1.vals ~= c2.vals 0041 result = 0; 0042 return 0043 end