This is part of my code:
double h;
double sigma;
/* The gateway function */
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
double *nor;
int n = mxGetScalar(prhs[0]);
h = mxGetScalar(prhs[1]);
nor = mxGetPr(prhs[2]);
sigma = mxGetScalar(prhs[3]);
double *x;
/* create the output vector */
plhs[0] = mxCreateDoubleMatrix(1,n,mxREAL);
/* get a pointer to the real data in the output matrix*/
x = mxGetPr(plhs[0]);
/* call the computational routine */
createTRR(x,n,nor);
}
If I try to compile it in matlab with mex myfilename.c I get the following errors:
- error C2143: syntax error : missing ';' before 'type' (in this line:
double *x;
) - error C2065: 'x' : undeclared identifier (in this line
x = mxGetPr(plhs[0]);
) and - error C2065: 'x' : undeclared identifier (in this line
createTRR(x,n,nor);
)
I dont see whats wrong, and I also dont understand why no error is thrown for *nor but only for *x. I wrote the code with Matlab2012 on ubuntu and it worked. Now I am currently using Matlab 2013b on Win7 with Microsoft Software Development Kit (SDK) 7.1 as C++ compiler.