Launch MCR in a C# code

조회 수: 18 (최근 30일)
Notocord
Notocord 2012년 5월 7일
Hello,
I would like to execute Matlab functions in a C# code (VS2010, W7). My C# code is as follows:
// Declaration
DllImport(@"C:\Program Files\MATLAB\MATLAB Compiler Runtime\v715 bin\win32\libeng.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr engOpen(string startcmd);
// Call MCR
IntPtr engine = engOpen(null);
Matlab is launched but however crashs immediately without any log or information...
Any idea?
Thanks for your help!

채택된 답변

Friedrich
Friedrich 2012년 5월 7일
Hi again,
Since you have an installed MATLAB and working with C#, why arent you using COM directly? This makes it a way easier:
And make sure MATLAB is registered as COM server. In order to register it run
regmatlabserver
in MATLAB.

추가 답변 (2개)

Notocord
Notocord 2012년 5월 7일
Hi,
Thank you for your quick answer.
I also tried with the installed version of Matlab on my computer, i.e. the link to the libeng.dll is C:\Program Files\MATLAB\R2010a\bin\win32\libeng.dll
But I have the save behavior. I think there is another problem...?

Notocord
Notocord 2012년 5월 7일
Ok, understood the idea! I will dig in that way. Thank you very much!

카테고리

Help CenterFile Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by