필터 지우기
필터 지우기

How to break out of loop when debugging?

조회 수: 27 (최근 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 CenterFile Exchange에서 Loops 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