How can I store my results from each iteration of a FOR loop?
Show older comments
How can you specify the introduction of a new variable for every iteration of a for loop. For instance, is
phi = [a,b,c,d]
for i = 1:3
y = [sin(phi(i)),cos(phi(i));sin(phi(i)),cos(phi(i))]
end
I would like the for loop to specify the new variable for each iteration of the for loop, such that
L = [sin(phi(1)),cos(phi(1));sin(phi(1)),cos(phi(1))]
M =[sin(phi(2)),cos(phi(2));sin(phi(2)),cos(phi(2))]
N =[sin(phi(3)),cos(phi(3));sin(phi(3)),cos(phi(3))]
Accepted Answer
More Answers (1)
Doug Hull
on 2 Feb 2011
1 vote
This is a bad idea.
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!