フィルターのクリア

how to stop executing while loop?

2 ビュー (過去 30 日間)
Ramesh Singh
Ramesh Singh 2020 年 10 月 28 日
コメント済み: Ramesh Singh 2020 年 10 月 28 日
x=1;
while x>0
x+1
end
  2 件のコメント
KSSV
KSSV 2020 年 10 月 28 日
This is an infinite loop...it will not stop....to force stop use ctrl + c .
Ramesh Singh
Ramesh Singh 2020 年 10 月 28 日
i already type this statement and it run , then i type clc clear delete variable it does't work,
thank kssv ctrl+c is right to stop

サインインしてコメントする。

採用された回答

KSSV
KSSV 2020 年 10 月 28 日
You can set a condition like below and exit the while loop.
x=1;
while x<10
x = x+1 ;
end

その他の回答 (1 件)

Alan Stevens
Alan Stevens 2020 年 10 月 28 日
Use a condition inside the while loop, such as
if x>10, break, end

カテゴリ

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

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by