Filter löschen
Filter löschen

How to break out of loop when debugging?

27 Ansichten (letzte 30 Tage)
Hao Sun
Hao Sun am 15 Apr. 2020
Kommentiert: Walter Roberson am 16 Dez. 2020
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 Kommentare
Walter Roberson
Walter Roberson am 15 Apr. 2020
I don't think you can do that.
Christopher Harris
Christopher Harris am 14 Okt. 2020
I have the same problem

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi am 21 Apr. 2020
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 Kommentare
mikhailo
mikhailo am 16 Dez. 2020
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 am 16 Dez. 2020
In the editor you can point to a line, right click and choose "run to cursor"

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by