throw
抛出异常
说明
throw(
根据 exception
)MException
对象 exception
中包含的信息抛出异常。该异常终止当前正在运行的函数,并将控制权返回到键盘或封闭的 catch
块。从 try/catch
语句外部抛出异常时,MATLAB® 将错误消息显示在命令行窗口中。
throw
函数不同于 throwAsCaller
和 rethrow
函数,它从 MATLAB 调用函数的位置创建堆栈跟踪。
可以通过 try/catch
语句或 MException.last
函数访问 MException
对象。
示例
输入参数
扩展功能
版本历史记录
在 R2007b 中推出
另请参阅
rethrow
| throwAsCaller
| MException.last
| try,
catch
| error