Hi, dont know if this is possible but I'll ask anyway.
I have a 100*2 matrix. I want to check if each value equals 1 or zero, if it's 1 multiply it by some number and have that saved as some new variable. I then want to sum those variables per row and store those totals in a new 100*1 matrix.
I understand this code doesnt make actual sense but it indicates what im trying to achieve. Can anyone point me in the right direction?
Thanks in advance to anyone for help, it's really appreciated.
val1 = 0;
val2 = 0;
multiplier1 = 10
multiplier2 = 15
for i = 1:100
if matrix(i,1) == 1
val1(i) = matrix(i,1)*multiplier1
if matrix(i,2) == 1
val2(i) = matrix(i,2)*multiplier2
rowtotal(i) = val1(i) +val2(i)