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

조회 수: 17 (최근 30일)
João Carvalho
João Carvalho 2017년 10월 26일
댓글: Walter Roberson 2017년 10월 26일
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일
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일
Break is used to stop for or while loops. Just throw an error by typing:
error('Break');

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by