01-03-2013 03:22 AM
int SendMatrix(CAObjHandle hMatlab, char *matlabName, double *matrixReal,
double *matrixImag, unsigned dim1, unsigned dim2)
{
LPSAFEARRAY saReal = NULL;
LPSAFEARRAY saImag = NULL;
HRESULT stat;
/* Check that valid pointers have been passed for the matrices */
if((!matrixReal) && (!matrixImag))
{
return ERROR_INVALID_MATRIX;
}
/* Convert the real and imaginary matrices into SAFEARRAYs */
if(matrixReal)
{
stat = CA_Array2DToSafeArray (matrixReal, CAVT_DOUBLE, dim1,
dim2, &saReal);
if (stat < 0)
{
return ERROR_ARRAY_CONVERSION;
}
}
if(matrixImag)
{
stat = CA_Array2DToSafeArray (matrixImag, CAVT_DOUBLE, dim1,
dim2, &saImag);
if (stat < 0)
01-03-2013 05:48 AM
Hi,
The error message you receive tells you that the array paased to the function is too small - you will have to pass an array with the appropriate size, i.e. at least twice the number of elements