フィルターのクリア

How can I let the loop continue when the condition is satisfied ?

2 ビュー (過去 30 日間)
omar th
omar th 2022 年 3 月 20 日
コメント済み: omar th 2022 年 4 月 18 日
I formulated a potential game theory and I want the loop continue when reach Nash equilibrium( or when the condition that I make it inside the loop is achieved), as well as to display an message for example Reach Nash or condition is achieved. Thanks in advance

採用された回答

Image Analyst
Image Analyst 2022 年 3 月 20 日
編集済み: Image Analyst 2022 年 3 月 20 日
for loop or while loop? Is the condition not true to begin with? So if the condition does not switch to true inside the loop, the loop exits after one iteration? For a while loop it would be something like this
loopCounter = 1;
maxIterations = 1000000;
nashCondition = false;
while (nashCondition || loopCounter == 1) && (loopCounter < maxIterations)
nashCondition = some new value, either true or false. Not sure how you compute this.
% Loop will continue if nashCondition is true, and will exit if it's false.
if nashCondition
fprintf('On iteration %d the Nash Condition is true.\n', loopCounter);
end
loopCounter = loopCounter + 1;
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