How can I stop the program? "Break" - Error

I am using a "Break" to stop the program but it is showing an error. How can I solve that and stop the program? Thanks

 採用された回答

OCDER
OCDER 2017 年 10 月 26 日

0 投票

break is used to break a for or while loop. Use return instead to end the function. Use error(some error message) to completely end the program due to an error.

1 件のコメント

Walter Roberson
Walter Roberson 2017 年 10 月 26 日
Use pause() to have the program wait for you to press a key. Use keyboard() to have the program switch to command mode without exiting the function.

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

その他の回答 (1 件)

Birdman
Birdman 2017 年 10 月 26 日

1 投票

Break is used to stop for or while loops. Just throw an error by typing:
error('Break');

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2017 年 10 月 26 日

コメント済み:

2017 年 10 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by