That's correct. What's the signature that mexCallMATLAB expects?
http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/mexcallmatlab.html
Your fourth input argument is not of the correct type. Look at the
mexcallmatlab.c example file (the first file listed in the Examples section
on that page) for an example of how to call mexCallMATLAB with inputs of the
correct type.
--
Steve Lord
sl...@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
I've solved, I used a mxArray but this makes me take another question as you can move from a mxArray to double
"Steven Lord" <sl...@mathworks.com> wrote in message <hrp7gd$am4$1...@fred.mathworks.com>...
Look at mxGetPr and/or mxGetData.
You need to post your code, not just the error messages.
James Tursa
I so sorry , i forget the code sorry again, this is all the code
URL: http://pastebin.com/sWKhXP8D
Thx
"Rafael Valenzuela" <rav...@gmail.com> wrote in message <hrtvd4$s8v$1...@fred.mathworks.com>...
e.g., this works (fres.c):
#include "mex.h"
void mexFunction( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[]){
mxArray *theArray[9];
mxArray *imagen_out[1];
if(!mxIsDouble(prhs[0])||!mxIsDouble(prhs[1])||!mxIsDouble(prhs[2])||!mxIsDouble(prhs[3])||!mxIsDouble(prhs[4])||!mxIsDouble(prhs[5])||!mxIsDouble(prhs [6])||!mxIsDouble(prhs[7])||!mxIsDouble(prhs[8])){
mexErrMsgTxt("Must be called with a valid handle");
}
if( mexCallMATLAB(1, imagen_out, 9, prhs, "fresnel") ) {
mexErrMsgTxt("fresnell function didn't work");
}
// imagen_out[0] has the result, use it here
mxDestroyArray(imagen_out[0]); // destroy it when done with it
}
e.g., calling sequence:
>> fres(1,2,3,4,5,6,7,8,9)
Inside fresnel
45
e.g., the fresnel.m file:
function out = fresnel(a1,a2,a3,a4,a5,a6,a7,a8,a9)
out = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9;
disp('Inside fresnel');
disp(out);
end
James Tursa
Hi James Tursa
My fresnel function doesn't make exactly that, the problem is the cast type between mxArray and double.
this is a head of my function :fresnel(imagen,l,z,tax,tay,fx,fy,n,m) and it returns a Imagen , all parameters it's double, the question is .
it's possible to convert a mxArray to double?.
Moreover i need to use a C function no Matlab function