How to break out of loop when debugging?

37 ビュー (過去 30 日間)
Hao Sun
Hao Sun 2020 年 4 月 15 日
コメント済み: Walter Roberson 2020 年 12 月 16 日
I tried using the break statement, but I just get a Error: A BREAK statement appeared outside of a loop. Use RETURN instead. error despite the fact that I am definitely inside a while loop right now.
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 4 月 15 日
I don't think you can do that.
Christopher Harris
Christopher Harris 2020 年 10 月 14 日
I have the same problem

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

回答 (1 件)

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi 2020 年 4 月 21 日
Hi,
If you are trying to know how to come out of a loop while debugging, you could just place a breakpoint just below the loop and click on continue(F5).
As far as the error is concerned, you might have probably missed or misplaced an 'end'.
  2 件のコメント
mikhailo
mikhailo 2020 年 12 月 16 日
I had exactly the same thought while debugging a lengthy file: every-time setting a breakpoint and typing F5 feels clumsy.
As a user I would suggest the following: make a hotkey to exit the loop in debugging mode, for example ctrl-shift-F11.
I think it is potentially a handy feature that users would appreciate.
Walter Roberson
Walter Roberson 2020 年 12 月 16 日
In the editor you can point to a line, right click and choose "run to cursor"

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

カテゴリ

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

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by