mxArray *rhs[1];
rhs[0] = (mxArray *)prhs[4];//phrs[4]为mexfunction传过来的arguement
mxArray *nneighbors_array;
mexCallMATLAB(1, &nneighbors_array, 1, rhs, "numel");
int nneighbors = (int)*mxGetPr(nneighbors_array);
mexPrintf("the total number of neighbors is %d", nneighbors);