While loop stop when repeat answers

1 visualizzazione (ultimi 30 giorni)
Peyton Reddick
Peyton Reddick il 11 Lug 2019
Risposto: Walter Roberson il 11 Lug 2019
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?

Risposte (1)

Walter Roberson
Walter Roberson il 11 Lug 2019
old = nan
New = nan
while old ~= New
old = New
New = whatever
end

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by