has use of "break" changed recenty?
조회 수: 20 (최근 30일)
이전 댓글 표시
I have script which has functioned well under previous version of MatLab, recently updated the software to 2016a, and now get following error when running script.
Error: A BREAK may only be used within a FOR or WHILE loop, and then only within the same file as its corresponding FOR or WHILE statement.
Has the use of the break function changed?
댓글 수: 4
Rik
2020년 12월 13일
Yes, all of this is from local copies (only some of these required a VM). So unfortunately the time machine in question is metaphorical. The Wayback Machine will probably not have many of these.
채택된 답변
Star Strider
2016년 10월 11일
편집: Star Strider
2016년 10월 11일
It has, several versions ago. If you want to stop a script outside of a loop, use return instead of break. It does the same thing, and won’t throw an error.
To wit:
fprintf(1, 'Before ''return''\n')
return
fprintf(1, 'After ''return''\n')
EDIT — Added demonstration code snippet.
댓글 수: 3
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!