While loop stop when repeat answers
显示 更早的评论
I am currently working on a while loop to get an estimate for pi^2/6. How do I stop the while loop one it starts to produce the same answer over and over?
回答(1 个)
Walter Roberson
2019-7-11
old = nan
New = nan
while old ~= New
old = New
New = whatever
end
类别
在 帮助中心 和 File Exchange 中查找有关 Random Number Generators 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!