MATLAB: Gettting error in this mex file

mexurgent

Hello…I have this mex-matlab code and I get error when I try to debug it..The file name is pred_lt_3.c and the code is:
{
#include mex.h
#include "matrix.h"
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
int k,frac;
int i,j;
double *exc,*b30,*T,*fraction;
double *u1,*v;
exc=mxGetPr(prhs[0]);
T=mxGetPr(prhs[1]);
fraction=mxGetPr(prhs[2]);
b30=mxGetPr(prhs[3]);
plhs[0]=mxCreateDoubleMatrix(1,40,mxREAL);
v=mxGetPr(plhs[0]);
u1=(double *)mxCalloc(200,sizeof(double));
k=(int) T[0];
frac=(int) fraction[0];
frac=-frac;
if (frac==-1)
{
k=k+1;
frac=2;
}
for (i=0;i<200;i++)
{
u1[i]=exc[i];
}
for (i=0;i<40;i++)
{
for (j=0;j<10;j++)
{
v[i]=v[i]+u1[(i-k+160-j)]*b30[(frac+3*j)]+u1[i-k+160+j]*b30[3-frac+3*j];
u1[159+i]=v[i];
}
}
mxFree(u1);
}
}
error:??? Undefined function or method 'pred_lt_3' for input arguments of type 'double'.
Please,Can anyone solve this error? It's very urgent…

Best Answer

Did you mex the file?
mex pred_lt_3.c
You need to mex the file before you can use it....
Also, the beginning { and ending } will cause an error, and the include mex.h is incorrect. It should be:
#include "mex.h"