MATLAB: Row addition on matrix

sum product algorithm

Hello everyone, i got error in my coding , can you please help me.
A=[-0.5000, 2.5000, -4.0000, 5.0000, -3.5000, 2.5000]
B=[2.4217, -0.4930, 0, -0.4217, 0, 0
0, 3.0265, -2.1892, 0, -2.3001, 0
-2.1892, 0, 0, 0, -0.4217, 0.4696
0, 0, 2.4217, -2.3001, 0, -3.6869]
here i want to add row element with each other and gives single row matrix. i.e. C11= 0-2.1892+Aij =-2.1892-0.500=-0.2676 (i have to avoid the element belongs to current value of i and j)
C=[-0.2676, 5.0334, -3.7676, 2.2783, -6.2217, -0.7173]
how can i get this single row matrix using mat lab code? can anyone help me please.
for i=1:4
for j=1:6
sum=0;
for jj=1:6
if H(jj,j)==1 && jj~=i
sum=sum+B(jj,j)
end
end
if H(jj,j)==1 && jj~=i
C(i,j)=sum+A(i,j)
end
end
H=[1 1 0 1 0 0;
0 1 1 0 1 1;
1 0 0 0 1 1;
0 0 1 1 0 1]
where, jj=set of row locations of the H matrix equation

Best Answer

C = sum([A;B]);