What is double [*, *]?

I am currently trying to convert a .mat file to XML. For this task, I have to use a library that returns a dynamic object to me. I know the structure of the .mat file, so I can get data from it. I store this data in an object. One of the values โ€‹โ€‹in the .mat file is of type MATLAB <1701x256 double>

. I thought it would be double[][]

. But when I try to assign a value, I get:

Unbehandelte Ausnahme: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Der 
double[*,*]-Typ kann nicht in double[][] konvertiert werden.
   bei CallSite.Target(Closure , CallSite , Object )
   bei System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site,T0 arg0)
   bei CameraParser.Program.Main(String[] args) in c:\myProject\Program.cs:Zeile 44.

      

What is double[*,*]

type? What type should the attribute of the object to which I assign the value be be of?

I tried

double[][] myAttribute;

      

and

double[] myAttribute;

      

and

double** myAttribute;

      

The last one gave

Error   6   Pointers and fixed size buffers may only be used in an unsafe context

      

+3


source to share


1 answer


*

in the type name indicates that you have a non-matching array type. Typically with COM servers, they use 1 as the lower bound. You cannot overlay such an array on a C # array type, it only supports arrays with a lower bound of 0. But you can apply it to Array

.



Use array methods to access the array. Like Array.GetLowerBound (), you will learn where to start indexing, GetUpperBound () to find out where to stop. Read an element of the array using Array.GetValue (). You will need an overload that accepts int [] as it is a two dimensional array, not a jagged array.

+3


source







All Articles