Type conversion C# and Matlab

  • Thread starter Thread starter hakansilver
  • Start date Start date
H

hakansilver

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.basicstatistics(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
 
Hakan,

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

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

HTH
Kalpesh
 
Back
Top