可以通过脚本中的语句来停止Matlab M脚本吗? [英] Can a Matlab M-script be stopped by a statement in the script?

查看:144
本文介绍了可以通过脚本中的语句来停止Matlab M脚本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个非常简单,也许很明显的问题:如何使用脚本中的一条语句中止执行Matlab M脚本?

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

这类似于在函数中间调用return以立即结束它.

This is analogous to calling return in the middle of a function to end it immediately.

推荐答案

如果 return 不需要您,我想您要使用 break

break终止Matlab代码的执行.例如,循环语句中出现在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.

这篇关于可以通过脚本中的语句来停止Matlab M脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆