How to use for loop for iterations.
for i=1:3
a=rand(3,1);
b=5.*(a.^2);
c=[a b]
end
At the end i get a value of c that is of the order of 3×2, that is the final value that comes after3rd iteration. So value of c gets changed in each iteration.
How I can get all value of c of the loop.
In other words i want to get c of the order 9×2 (3 iterations and three values for each iteration).for i=1:3
a=rand(3,1);
b=5.*(a.^2);
c=[a b]
end
At the end i get a value of c that is of the order of 3×2, that is the final value that comes after3rd iteration. So value of c gets changed in each iteration.
How I can get all value of c of the loop.
In other words i want to get c of the order 9×2 (3 iterations and three values for each iteration). for i=1:3
a=rand(3,1);
b=5.*(a.^2);
c=[a b]
end
At the end i get a value of c that is of the order of 3×2, that is the final value that comes after3rd iteration. So value of c gets changed in each iteration.
How I can get all value of c of the loop.
In other words i want to get c of the order 9×2 (3 iterations and three values for each iteration). for loop, iteration MATLAB Answers — New Questions