Type conversion C# and Matlab

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?aGFrYW5zaWx2ZXI=?=

    Type conversion C# and Matlab

    Dear all,

    We try to access a third party Matlab dll (which was created using Matlab
    COM Builder) from C#. It works fine when using strings and one-dimensional
    arrays but fails with two-dimensional arrays. We give our example of the code
    below:

    static void TestBasicStat()
    {

    MatlabCOM pda = new MatlabCOM();
    Object mError = new int();
    Array TempTagValues = new double[10, 20];
    Object gaTagValues = new Object(); // This is the result from
    Matlab. It should be a 2-dim array
    pda.basicstatis tics(2, ref gaTagValues, ref mError,
    TempTagValues);
    }

    An exception is thrown from the Matlab code when Matlab tries to access the
    two-dimensional array.

    Does anyone know if a double array is the correct conversion to a Matlab
    matrix?

    Also, please let me know if this is not the right newsgroup to post for this
    question.

    Thank you in advance!

    Best regards

    Hakan
  • Kalpesh

    #2
    Re: Type conversion C# and Matlab

    Hakan,

    I have not worked with matlab & using com from c#.
    However, I have a suggestion

    What does the intellisense show when you pda.basicstatis tics(
    Also, you could change
    Array TempTagValues = new double[10, 20];
    to
    double[,] TempTagValues = new double[10, 20];

    HTH
    Kalpesh

    Comment

    Working...