matlab - 从使 matlab 崩溃的函数中检索变量

标签 matlab variables

有没有办法检索未正确完成的函数的输出?

例如,一个(非全局)变量被函数正确计算但由于语法错误而无法正确保存。

最佳答案

原则上,一旦程序因错误而停止,您就无法查看函数。 (这就是为什么我经常尝试避免使用函数。)

但是,您可以通过使用 dbstop 进入 Debug模式 来实现您想要的效果。设置断点的函数:

The dbstop function is used to temporarily stop the execution of a program and give the user an opportunity to examine the local workspace.

特别是打字

dbstop if error

在运行代码之前在命令窗口中将使其停止在导致错误的位置并查看该函数中的变量。

恢复正常行为,您需要 dbclear功能。类型

dbclear if error

删除之前设置的断点,或者

dbclear all

删除所有断点。

关于matlab - 从使 matlab 崩溃的函数中检索变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33129226/

相关文章:

matlab - 相对于不同坐标系的轴缩放和旋转 3D 点

matlab - Camera Calibration Intrinsic Matrix 值代表什么?

algorithm - 使用循环对数据进行分组(MATLAB 中的信号处理)

c# - 从文本文件命名变量

javascript - 如何混淆 JavaScript 中的变量名?

Python - 在字符串上打印变量

arrays - 将 'True' 和 'False' 值的单元格转换为 1 和 0 的数值数组

matlab - 如何在matlab中向量化双重求和

戈兰 |如何检查单个 if 语句中的多个 bool 值是否为 true?

variables - 如何更改 makefile 变量文件扩展名?