R
ronny
Can anyone tell me why the following code works fine using an array.
<snip>
double xVal[40000]; // array
mxArray *X = NULL; //MatLab mxArrays
..
..
..
//Create mxArray
X = mxCreateDoubleMatrix(imgSize, 1, mxREAL);
//Copy values from xVal array to mxArray
memcpy((void *)mxGetPr(X), (void *)xVal, sizeof(xVal));
<snip>
but when I try and do the same thing using a pointer like this the data is
not copied using memcpy.
<snip>
double *xVal = new double[imgSize];
..
..
memcpy((void *)mxGetPr(X), (void *)xVal, sizeof(xVal));
<snip>
Can I get memcpy to work using a pointer and if so how? Thank you
<snip>
double xVal[40000]; // array
mxArray *X = NULL; //MatLab mxArrays
..
..
..
//Create mxArray
X = mxCreateDoubleMatrix(imgSize, 1, mxREAL);
//Copy values from xVal array to mxArray
memcpy((void *)mxGetPr(X), (void *)xVal, sizeof(xVal));
<snip>
but when I try and do the same thing using a pointer like this the data is
not copied using memcpy.
<snip>
double *xVal = new double[imgSize];
..
..
memcpy((void *)mxGetPr(X), (void *)xVal, sizeof(xVal));
<snip>
Can I get memcpy to work using a pointer and if so how? Thank you