I am having problems using .NET Framework 4 with a compiled library using R2015b. I am trying to create an MWArray of UInt16 values (the library requires this and errors out on doubles and signed integers), but I am getting the error message "The data array type is invalid." when try either of these methods:
UInt16[] inputBytes; /// ... Fill array... MWArray mwInputData = (MWNumericArray)inputBytes;MWArray mwInputData2 = new MWNumericArray(inputBytes);
We have used the same Matlab code in a C++ DLL library, and been able to create the MWArray like this:
unsigned short* raw_pixels;/// ... Fill array... mwInputData = mwArray(pixel_count, 1, mxUINT16_CLASS, mxREAL);mwInputData.SetData(raw_pixels, pixel_count);
I am unable to find a way to create a typed MWArray in .NET and still be able to fill it, the only constructor that accepts a type (i.e., MWNumericType.UInt16) does not initialize the size (as far as I can tell), and when I try to set a value inside the array I get an index error.
Any ideas?
Thank you, -Andy
Best Answer