Mex File. Too many output arguments
Mostrar comentarios más antiguos
Hello
I have created a mex file which works fine when is called with only an output argument, but it gives me the next output when called with more than one:
??? Error using ==> mtimes Too many output arguments.
I manage the output arguments in the mex function like shown next:
void mexFunction( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] ) { mxArray *Result0,*Result1,*Result2,....
....
Result0 = mxCreateDoubleMatrix(N,M,mxCOMPLEX);
ResultValuesRe0 = mxGetPr(Result0);
ResultValuesIm0 = mxGetPi(Result0);
Result1 = mxCreateDoubleMatrix(N,M,mxCOMPLEX);
ResultValuesRe1 = mxGetPr(Result1);
ResultValuesIm1 = mxGetPi(Result1);
Result2 = mxCreateDoubleMatrix(N,M,mxCOMPLEX);
ResultValuesRe2 = mxGetPr(Result2);
ResultValuesIm2 = mxGetPi(Result2);
....
....
plhs[0] =Result0; plhs[1] =Result1; plhs[2] =Result2;
}
I just do not get it. This is the way I created some mex files some time ago, and they worked out.
Why this error when calling with, for example, two output arguments?
The way I call it: [x,y] = function_mex(input_arguments)
2 comentarios
Walter Roberson
el 22 de Dic. de 2011
How does the "mtimes" figure in to this? Does the code call the MATLAB mtimes, or did you call your code mtimes ?
Christian
el 26 de Dic. de 2011
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!