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

后端 未结 3 494
误落风尘
误落风尘 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:43

    If return is not want you need, I think you want to use break

    break terminates the execution of a Matlab code. For example, statements in the loop that appear after the break statement are not executed.

    In nested loops, break exits only from the loop in which it occurs. Control passes to the statement that follows the end of that loop.

提交回复
热议问题