MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   MATLAB“ C” DLL错误 (https://www.labfans.com/bbs/showthread.php?t=22571)

poster 2019-12-07 23:17

MATLAB“ C” DLL错误
 
我正在将一些MATLAB函数编译到一个C DLL中。导出的mlf函数返回一个布尔值,表示该函数是否成功。当返回值为false时,我想找出错误信息。我找不到办法! (除了编译和导出lasterror()函数)。

是否有一个C接口来获取MATLAB运行时生成的最后一个错误?

回答:
好吧,让我们尝试...

[URL="http://www.mathworks.com/help/techdoc/apiref/mexcallmatlabwithtrap.html"][B]mexCallMATLABWithTrap[/B][/URL] (C和Fortran)-调用MATLAB函数,用户定义的M文件或MEX文件并捕获错误信息

#include "mex.h" mxArray *mexCallMATLABWithTrap(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[], const char *functionName); 和

[URL="http://www.mathworks.com/help/techdoc/apiref/mexevalstringwithtrap.html"][B]mexEvalStringWithTrap[/B][/URL] (C和Fortran)-在调用者的工作区中执行MATLAB命令并捕获错误信息

#include "mex.h" mxArray *mexEvalStringWithTrap(const char *command); 这两件事是在Google上找到的,只有一个或两个猜测。抱歉,这很浪费时间。


所有时间均为北京时间。现在的时间是 23:28

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.