Matlab calling C# functions - different results depending on whether you use Matlab or MCR

1 view (last 30 days)
We have the following interface defined in C#:
[ComVisible(true)] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IIPHelper { double[,] GetXValues(ICurve curve, int depthIndex, int yIndex); }
and, when it is called, should return an array of values. If we are using full-blown Matlab, the result is correct (a 1*200 array with the correct values). If we access it through compiled Matlab, the result is always a 1*1 array with no data.
The matlab code snippet that calls the function is:
%read VDL at that row
global IPHelper;
VDL=IPHelper.GetXValues(STCCurve, i, nslows);
When debugging the implementation of the C# interface, the correct array is calculated in both cases. It's just that the compiled version doesn't return the array correctly.
I should say that, for various reasons, we are not referencing MWArray in the C# code and are using reflection to make calls into the Matlab DLL.

Answers (0)

Community Treasure Hunt

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

Start Hunting!