我有一个 matlab 脚本,它们时不时地生成消息:
Caught std::exception Exception message is:
bad allocation
Unexpected error status flag encountered. Resetting to proper state.
这可能是什么原因造成的?
最佳答案
这是 MATLAB 中的一个错误,其中 MATLAB 的某些部分未正确处理 std::bad_alloc 异常(std::bad_alloc 是从 C++ 运行时库抛出的内存不足异常)。
“遇到意外错误状态标志。正在重置为正确状态。”是一个内部诊断 - 您不应该看到它,除非 MATLAB 已进入错误状态,在本例中发生这种情况是因为它在意外的地方遇到了 bad_alloc。最新版本的 MATLAB 已修复大部分此类问题,但内存极低的情况除外(例如,剩余可用内存不足 1 KB)。您使用什么版本?
关于Matlab:获取 "Unexpected error status flag encountered. Resetting to proper state",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2705022/