I keep getting a crash in a mex file. I have no clue why there is a problem other than using mwSize instead of something else.
here is code cut down to only the problem
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
mwSize t, T;
T = mxGetN(prhs[0]);
for( t = T – 2; t >= 0; t–){
mexPrintf("Smooth %d\n",t);mexEvalString("drawnow;");
}/*end of t=T-2:0;*/
return;
}
this gets compiled with the -largeArrayDims flag.
then in matlab:
a= zeros(50,200); and run the above on a
I expect the printed t to go from 198 to 0 and then stop. Instead, it runs into negative numbers and doesn't stop unless killed.
Anyone know why?
Best Answer