Mex File. Too many output arguments
Show older comments
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 Comments
Walter Roberson
on 22 Dec 2011
How does the "mtimes" figure in to this? Does the code call the MATLAB mtimes, or did you call your code mtimes ?
Christian
on 26 Dec 2011
Accepted Answer
More Answers (0)
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!