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

1 visualización (últimos 30 días)
Christian
Christian el 1 de Oct. de 2015
Respondida: Rohit Kudva el 21 de Oct. de 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!

Respuestas (1)

Rohit Kudva
Rohit Kudva el 21 de Oct. de 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

Categorías

Más información sobre Deploy to .NET Applications Using MWArray API en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by