Hello,
i have following code which i want to modify ….
function new_fitness W =[0 0 0 3;0 0 0 0;0 0 0 0; 3 0 0 0 ]; cost=[1 1 1 1;1 1 1 1;1 1 1 1;1 1 1 1]; FC= [10 10 10 10;10 10 10 10;10 10 10 10;10 10 10 10]; Fn = cost.*W+(W>0).*FC disp(Fn); end
my output is—
Fn = 0 0 0 13 0 0 0 0 0 0 0 0 13 0 0 0
but i want to modify it such a way that particular FC element is added only once if both W(i,j) and W(j,i)>0. then my output will be like—
Fn = 0 0 0 13 0 0 0 0 0 0 0 0 3 0 0 0
Thank You
Best Answer