フィルターのクリア

checking if values are equal in a loop

3 ビュー (過去 30 日間)
María Jesús
María Jesús 2015 年 1 月 7 日
回答済み: Guillaume 2015 年 1 月 7 日
Hi,
I have a program that estimates some parameters iteratively and returns the value after a set number of iterations of a for loop. Is there a way to get the loop to go on only until the result of two iterations are the same?
Thank you!

採用された回答

Guillaume
Guillaume 2015 年 1 月 7 日
Use a while loop:
lastvalue = Inf;
newvalue = -Inf;
while newvalue ~= lastvalue
lastvalue = newvalue;
newvalue = ... %the result of your calculation
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by