Can a Matlab M-script be stopped by a statement in the script?

后端 未结 3 491
误落风尘
误落风尘 2021-02-05 06:17

A very simple, and perhaps obvious, question: How can I abort execution of a Matlab M-script using a statement within the script?

This is analogous to calling ret

3条回答
  •  醉酒成梦
    2021-02-05 06:51

    As of Matlab R2015b break can no longer be used to pre-terminate a script. A break can now only be used to a for-loop. The code will not run and an error will be thrown. This was technically always true, but it is now enforced.

    The proper way is to use return

提交回复
热议问题