gpt4 book ai didi

debugging - 从错误位置出错后(重新)启动 Matlab

转载 作者:行者123 更新时间:2023-12-02 07:50:41 25 4
gpt4 key购买 nike

我正在调试一个运行大约需要 10 分钟的 matlab 脚本。在脚本的末尾,我对结果进行了一些 I/O 和简单的计算,但我不断遇到错误。有没有办法在脚本中出现错误后从某个运动中启动 matlab——数据仍在工作区中,所以我可以注释掉错误点之前的所有代码,但我想知道如果有人知道在不重新运行整个脚本的情况下执行此操作的更好方法(超懒惰/低效的方法)?

谢谢,

科罗拉多州

最佳答案

是的,使用 dbstop .键入 dbstop if error 然后运行您的脚本。当它遇到错误时,它会在那里创建一个断点,你就在脚本的工作区中——这意味着你可以调试错误,保存数据;任何你想要的!这是 dbstop if error 文档中的一个片段——还有其他方法可以执行 dbstop,所以请检查一下:

dbstop if error

Stops execution when any MATLAB program file you subsequently run produces a run-time error, putting MATLAB in debug mode, paused at the line that generated the error. The errors that stop execution do not include run-time errors that are detected within a try...catch block. You cannot resume execution after an uncaught run-time error. Use dbquit to exit from debug mode.

关于debugging - 从错误位置出错后(重新)启动 Matlab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4002702/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com