LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI调用SendMatrix出错,FATAL RUN-TIME ERROR: "matlabutil.c", line 221, col 39, thread id 0x00001928: Array argument too small (320000 bytes). Argument must contain at least 640000 bytes (640000 elements).

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)

0 Kudos
Message 1 of 2
(4,403 Views)

Hi,

 

  • a meaningful subject would be appropriate (e.g., the information about your line, column and thread id is completely useless for us)
  • if you expect an answer, you should post a question... we are not dogs waiting for bones to be thrown
  • if you are new to the forum, read and adhere to the introduction which you will find here

 

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

0 Kudos
Message 2 of 2
(4,398 Views)