"jimmy bodo" wrote in message <email@example.com>... > In the code below > > for r=7:15 > for s=15:22 > > total=1; > > while(i<=...) > > operations on total > > end > i=i+1; > end > > record(s)=total > end > final(r)=max(total) > > why is it that all the values in record and final are 1. shouldn't the value of total be updated?
Don't you want
INSIDE the while loop?
BTW, its a good idea to avoid using i (and j) as an index since it is used by MATLAB as the sqrt(-1)? Sooner or later this nuance is going to bite you.