0001 function plusAB = cplus(A,B)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 if isnumeric(A) && iscstruct(B)
0017 realA = real(A);
0018 imagA = imag(A);
0019 plusAB.real = realA + B.real;
0020 plusAB.imag = imagA + B.imag;
0021
0022 elseif iscstruct(A) && isnumeric(B)
0023 realB = real(B);
0024 imagB = imag(B);
0025 plusAB.real = realB + A.real;
0026 plusAB.imag = imagB + A.imag;
0027
0028 elseif isnumeric(A) && isnumeric(B)
0029 plusAB = A + B;
0030
0031 elseif iscstruct(A) && iscstruct(B)
0032 plusAB.real = A.real + B.real;
0033 plusAB.imag = A.imag + B.imag;
0034
0035 else
0036 ME = MException('cplus:inputError', ...
0037 'Input does not have the expected format.');
0038 throw(ME);
0039 end
0040
0041 end