开发者

engOpen returns Null

I'm having a problem when I try t开发者_运维知识库o call a Matlab funcion from my C++ code.

When I call engOpen, it always returns NULL. Here is the code:

Engine *m_pEngine;
m_pEngine = engOpen(NULL);
if(m_pEngine == NULL)
{
   cout << "Error" << endl;
   exit(1);
}

Does somebody know how to solve this?

Thanks !!!


If you look at the engOpen documentation it says:

On Windows systems, engOpen opens a COM channel to MATLAB. The MATLAB software you registered during installation starts. If you did not register during installation, on the command line you can enter the command:

matlab /regserver

I'm not sure that is your problem, but it seems worth a try.


you need to launch Matlab in administrator mode right-click on the Matlab icon and select "run as administrator"

You should check this even if you have registered Matlab during admin, if it is not currently registered as the COM link then it will not support engOpen.

also engOpen("") should work

This is not quite all that there is to it, there are certain mods that you have to keep in mind for the IDE configuration (or the linker and include options if you're using a command-line compiler).

Here's a Matlab admin page to resolve these problems. Beyond the COM link issue.

https://www.mathworks.com/matlabcentral/answers/100603-how-can-i-compile-a-matlab-engine-application-using-microsoft-visual-studio-9-0-or-10-0

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜