MATLAB API for C 异常使用 matGetDir: matrix::serialize::EndOfFile 在内存位置 [英] MATLAB API for C exception using matGetDir: matrix::serialize::EndOfFile at memory location

查看:39
本文介绍了MATLAB API for C 异常使用 matGetDir: matrix::serialize::EndOfFile 在内存位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 Windows 7 上的 c++ Visual Studio 2017 项目中读取 mat 文件.我使用来自 Matlab R2017b 的 MATLAB API for C.

I try to read a mat file in a c++ Visual Studio 2017 project on Windows 7. I use the MATLAB API for C from Matlab R2017b.

我可以使用 mex 在 Matlab 中运行 matdgns.c 示例.

I am able to run the matdgns.c example in Matlab using mex.

也可以在我的 c++ 项目中运行应用程序并使用

It's also possible to run the application in my c++ project and open the mat file using

pmat = matOpen(file, "r");

但是,当我尝试使用 matGetDir

dir = (const char **)matGetDir(pmat, &ndir);

我得到一个例外:

在 project_gTest.exe 中的 0x000007FEFCF4A06D 处抛出异常:Microsoft C++ 异常:matrix::serialize::EndOfFile 在内存中位置 0x000000000031F1D0.

Exception thrown at 0x000007FEFCF4A06D in project_gTest.exe: Microsoft C++ exception: matrix::serialize::EndOfFile at memory location 0x000000000031F1D0.

我该如何解决这个问题?我错过了另一个图书馆吗?

How can I solve this issue? Am I missing another library?

谢谢!

推荐答案

我从 Matlab 支持人员那里收到了以下解决"问题"的答案:

I received the following answer from Matlab support which "solves" the "issue":

我假设您得到"的这个异常基本上只是 Microsoft Visual Studio 2017 的输出"窗口中显示的一行文本,对吗?这实际上并没有使您的应用程序崩溃,对吗?

I assume that this Exception which you "get" is basically just a line of text shown in the "Output" Window of Microsoft Visual Studio 2017, right? And this is not actually crashing your application, correct?

如果确实如此,请注意 MSVS 2017 实际上确实在输出"中显示了第一次机会异常.如果这样的异常被捕获并处理,在这种特殊情况下,我确实希望 MATLAB 库处理这个,但没有实际问题.抛出异常然后处理它们是完全有效的.只有未处理的(第二次机会)异常才会导致真正的问题.

If that is indeed the case, please note that MSVS 2017 does in fact show first chance exceptions in "Output". If such an exception is caught and handled, where in this particular case I do expect that the MATLAB libraries handled this, there is no actual issue though. It is perfectly valid to throw exceptions and then handle them. Only unhandled (second chance) exceptions would lead to real problems.

忽略输出中显示的那行通常应该是完全安全的,并且实际上期望在使用 matGetDir 时抛出(并在内部捕获)此异常.

It should normally be perfectly safe to ignore that line which is shown in the Output and it is in fact expected that this Exception is thrown (and caught internally) when working with matGetDir.

这篇关于MATLAB API for C 异常使用 matGetDir: matrix::serialize::EndOfFile 在内存位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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