I got a problem with summation after looping. Here is the problem :
——————————————
for ri = 0:3
if ri == 0 mi = 1 elseif i > 0 mi = 1 end end
r = sum(ri)
——————————————
I'm expecting the result from r was 6 (0+1+2+3) but its result was 3. I think the sum command only read the last ri which is 3 and neglecting the other ri.
Any answer will be appreciated. Thanks!
Best Answer