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

1 Ansicht (letzte 30 Tage)
Christian
Christian am 1 Okt. 2015
Beantwortet: Rohit Kudva am 21 Okt. 2015
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!

Antworten (1)

Rohit Kudva
Rohit Kudva am 21 Okt. 2015
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

Kategorien

Mehr zu Deploy to .NET Applications Using MWArray API finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by