MWArray and C#: Returned Handle to Matlab figure is null in C#-Code

조회 수: 2 (최근 30일)
Christian
Christian 2015년 10월 1일
답변: Rohit Kudva 2015년 10월 21일
Hello,
we have an .NET application that calls Matlab-Function. We are using the MWArray.dll for the interaction between .NET and Matlab. We call the Matlab-Function with MWMCR.EvaluateFunction(). This matlab-function opens a plot/figure and returns the handle to this plot/figure. If we call this function from .NET the returned handle is always NULL. If we test this function in Matlab everything is fine. The handle is not null. It seems like the handle is getting lost between Matlab and .NET.
Thnx for your help!

답변 (1개)

Rohit Kudva
Rohit Kudva 2015년 10월 21일
Hi Christian,
I understand that you have compiled a MATLAB function (that opens a plot/figure and returns the handle to this plot/figure) to a .NET DLL that you have integrated with your .NET application. The function executes fine in MATLAB but returns NULL while called from .NET application.
There are certain data conversion rules used when converting MATLAB data type to native .NET types. You can look into the conversion table in this link. According to this conversion table, there is no native type in .NET for handles in MATLAB and thus the call to the MATLAB function from .NET application returns NULL.
Regards,
Rohit

카테고리

Help CenterFile Exchange에서 Deploy to .NET Applications Using MWArray API에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by