can i changed for loop index variable inside the loop in Matlab???
- by shawana
hi every one.
i need to change my loop variable inside the iterationa as ihave to acces array elements in the loop which is changing w.r.t size inside the loop.
ashort piece of code is that:
que=[];
que=[2,3,4];
global len;
len=size(que,2)
x=4;
for i=1:len
if x<=10
que(x)= 5;
len=size(que,2)
x=x+1;
end
end
que
array should print like:
2 3 4 5 5 5 5 5 5 5
but it is printed in such a way:
2 3 4 5 5 5.
how shuould it be accomplished in matlab?
in visual c++ it happen correctly and print
whole array of 10 elements which increases at run time
plz reply me if have any ideaabout this as i m new into matlab