a=1:5
for k=a
if k<3
a=[a k+5];
end
disp(k)
end
When I run this code, I get these results:
1
2
3
4
5
k uses only the initial vector when it enters to the loop. I want it to update the values of a and take the new values of a too. Thus, my question is how do I get this result:
1
2
3
4
5
6
7