Changing variable after each loop iteration
Show older comments
Will it be possible to change the variable or assign an new variable after each loop iteration
a=9
while a>0
a=input('Example')
end
I don't want to collect it in an array.
Thank you
Accepted Answer
More Answers (1)
Youssef Khmou
on 20 Feb 2013
Yes, you can but your example is not clear using infinite loop and an input each iteration .
for t=1:10
x=t; % each iteration x= t={1,,,,10} x(final)=10
end
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!