| Author |
Comment/Response |
Jessica
|
02/25/13 03:19am
I want to run a while loop multiple times with a new constant inside it.
I have tried putting the while loop within a for or do loop, but it the while loop is iterated with the same original constant value each time. Here is a very simplified version of what I have tried:
tMatrix = {t}; xMatrix = {x};
Do[While[0 <= t < 6, {t = t + 0.5, x = i + t,
tMatrix = Append[tMatrix, t], xMatrix = Append[xMatrix, x]}];
Print[xMatrix], {i, 0, 10, 2}]
or a for loop in place of the Do.
Either way, I get a set of matrices back, but they all have the same values. I want each new matrix to be the while loop evaluated at the NEW i. Can I accomplish this somehow??
URL: , |
|