Is there a size limitation to converting 3D array from C# to MWNumericArray?

1 visualización (últimos 30 días)
I have a c# application that needs to send some data to Matlab. The data is a 3D array of shorts.
My c# Conversion method looks like so:
public static MWArray ShortArrayToMWArray(short[,,] intArray, int v, int v1, int v2)
{
try
{
//MWArray MW = new MWNumericArray(intArray);
//return MW;
MWNumericArray matrix = null;
matrix = new MWNumericArray(MWArrayComplexity.Real, MWNumericType.Int8, v, v1, v2);
matrix = intArray;
return matrix;
}
catch (Exception ex)
{
Console.WriteLine(ex);
return new MWNumericArray();
}
}
My array is: {short[532, 512, 512]}. When I send in the whole thing, I get a very bizarre error message:
Capture.PNG
It's only when I started to play with the sizes that I started to doubt and ask this question. If I send in 1/4 of the array, it does the conversion (1/2 is still the same error):
// Copy 1/4 of the array into a tmp array
Array tmpArray = Array.CreateInstance(typeof(short), originalArray.GetLength(0)/4, originalArray.GetLength(1)/4, originalArray.GetLength(2)/4);
System.Array.Copy(voxelArray, tmpArray, originalArray.GetLength(0)/4 * originalArray.GetLength(1)/4 * originalArray.GetLength(2)/4);
MWArray mwVol = MatlabUtils.ShortArrayToMWArray((short[,,])tmpArray, originalArray.GetLength(0) / 4, originalArray.GetLength(1) / 4, originalArray.GetLength(2) / 4);
I'm guessing I'm doing the conversion wrong, but not sure.
Thanks

Respuestas (0)

Categorías

Más información sobre MATLAB Compiler SDK en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by