I have a matrix and I want to generate another matrix according to their elements using a loop.
If one ore more elements of a row is ==0 the correspondent row in the new matrix need to be 0.
If not, it needs to be the sum of the elements in the row.
Comb = % The initial matrix0 04.303 02.68 00 1.7054.303 1.7052.68 1.705% I need this output:H = [00006.0084.385]
I started with this loop:
for i = 1:size(Comb, 1)for j = 1:size(Comb, 2)x = (sum(Comb'))'if abs(Comb(i,j)) == 0endendend
But it gives that:
I do not know what insert on the if to display zeros when one element of the row is equal to zero.
Could you help me ?
Thans in advance !