cocla2
Computer
- Mar 7, 2007
- 1
I've included the "engine.h", and there is no problem while compiling. But when I execute the code, a first chance exception is ouccured while excuting "ar = mxGetPr(mp);"
The error is:
First-chance exception in CameraTest.exe (LIBMX.DLL): 0xC0000005: Access Violation
Can anyone help me? Your help will be very appreciated.
The source code is:
---------------------------------------
Engine *ep;
Engine *ep;
mxArray *mp, *ans;
double *ar, *detreal;
int i,j;
mp = mxCreateDoubleMatrix(3,3,mxREAL);
ar = mxGetPr(mp);
for (i=0; i<3; i++)
for (j=0; j<3; j++) {
*ar=1;
ar++;
}
ep = engOpen("");
engPutVariable(ep, "T", mp);
engEvalString(ep,"d = sum(sum(T));");
ans=engGetVariable(ep,"d");
detreal=mxGetPr(ans);
engClose(ep);
------------------------------------------
The error is:
First-chance exception in CameraTest.exe (LIBMX.DLL): 0xC0000005: Access Violation
Can anyone help me? Your help will be very appreciated.
The source code is:
---------------------------------------
Engine *ep;
Engine *ep;
mxArray *mp, *ans;
double *ar, *detreal;
int i,j;
mp = mxCreateDoubleMatrix(3,3,mxREAL);
ar = mxGetPr(mp);
for (i=0; i<3; i++)
for (j=0; j<3; j++) {
*ar=1;
ar++;
}
ep = engOpen("");
engPutVariable(ep, "T", mp);
engEvalString(ep,"d = sum(sum(T));");
ans=engGetVariable(ep,"d");
detreal=mxGetPr(ans);
engClose(ep);
------------------------------------------