Hi :
I'm trying to call imread with mexCallMATLAB but I always get the same error that can be ? .
error: argument of type "double" is incompatible with parameter of type "mxArray **"
The code is this
<code>
double imag;
mxArray *str = mxCreateString("letras.tif");
mexCallMATLAB(1, &str, 1,imag, "imread");
printf("%f \n",imag);
</code>
|
|
0
|
|
|
|
Reply
|
Rafael
|
5/4/2010 11:45:07 AM |
|
"Rafael Valenzuela" <ravamo@gmail.com> wrote in message
news:hrp1c3$lif$1@fred.mathworks.com...
> Hi :
> I'm trying to call imread with mexCallMATLAB but I always get the same
> error that can be ? .
> error: argument of type "double" is incompatible with parameter of type
> "mxArray **"
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
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
|
0
|
|
|
|
Reply
|
Steven
|
5/4/2010 1:29:52 PM
|
|
Thanks Seteven:
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" <slord@mathworks.com> wrote in message <hrp7gd$am4$1@fred.mathworks.com>...
>
> "Rafael Valenzuela" <ravamo@gmail.com> wrote in message
> news:hrp1c3$lif$1@fred.mathworks.com...
> > Hi :
> > I'm trying to call imread with mexCallMATLAB but I always get the same
> > error that can be ? .
> > error: argument of type "double" is incompatible with parameter of type
> > "mxArray **"
>
> 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
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>
|
|
0
|
|
|
|
Reply
|
Rafael
|
5/4/2010 7:35:19 PM
|
|
"Rafael Valenzuela" <ravamo@gmail.com> wrote in message
news:hrpstn$9hh$1@fred.mathworks.com...
> Thanks Seteven:
>
> I've solved, I used a mxArray but this makes me take another question as
> you can move from a mxArray to double
Look at mxGetPr and/or mxGetData.
--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
|
0
|
|
|
|
Reply
|
Steven
|
5/5/2010 6:46:33 PM
|
|
"Steven Lord" <slord@mathworks.com> wrote in message <hrsee5$a0k$1@fred.mathworks.com>...
>
> "Rafael Valenzuela" <ravamo@gmail.com> wrote in message
> news:hrpstn$9hh$1@fred.mathworks.com...
> > Thanks Seteven:
> >
> > I've solved, I used a mxArray but this makes me take another question as
> > you can move from a mxArray to double
>
> Look at mxGetPr and/or mxGetData.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>
the same problem
error using mxGetData :
error: a value of type "void *" cannot be assigned to an entity of type "double"
error using mxGetPr :
error: a value of type "double *" cannot be assigned to an entity of type "double"
this is a code
|
|
0
|
|
|
|
Reply
|
Rafael
|
5/5/2010 7:28:06 PM
|
|
"Rafael Valenzuela" <ravamo@gmail.com> wrote in message <hrsgs5$l33$1@fred.mathworks.com>...
> "Steven Lord" <slord@mathworks.com> wrote in message <hrsee5$a0k$1@fred.mathworks.com>...
> >
> > "Rafael Valenzuela" <ravamo@gmail.com> wrote in message
> > news:hrpstn$9hh$1@fred.mathworks.com...
> > > Thanks Seteven:
> > >
> > > I've solved, I used a mxArray but this makes me take another question as
> > > you can move from a mxArray to double
> >
> > Look at mxGetPr and/or mxGetData.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> >
> the same problem
> error using mxGetData :
> error: a value of type "void *" cannot be assigned to an entity of type "double"
> error using mxGetPr :
> error: a value of type "double *" cannot be assigned to an entity of type "double"
> this is a code
You need to post your code, not just the error messages.
James Tursa
|
|
0
|
|
|
|
Reply
|
James
|
5/5/2010 9:23:04 PM
|
|
"James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hrsnjo$g43$1@fred.mathworks.com>...
> "Rafael Valenzuela" <ravamo@gmail.com> wrote in message <hrsgs5$l33$1@fred.mathworks.com>...
> > "Steven Lord" <slord@mathworks.com> wrote in message <hrsee5$a0k$1@fred.mathworks.com>...
> > >
> > > "Rafael Valenzuela" <ravamo@gmail.com> wrote in message
> > > news:hrpstn$9hh$1@fred.mathworks.com...
> > > > Thanks Seteven:
> > > >
> > > > I've solved, I used a mxArray but this makes me take another question as
> > > > you can move from a mxArray to double
> > >
> > > Look at mxGetPr and/or mxGetData.
> > >
> > > --
> > > Steve Lord
> > > slord@mathworks.com
> > > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > >
> > the same problem
> > error using mxGetData :
> > error: a value of type "void *" cannot be assigned to an entity of type "double"
> > error using mxGetPr :
> > error: a value of type "double *" cannot be assigned to an entity of type "double"
> > this is a code
>
> 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
|
|
0
|
|
|
|
Reply
|
Rafael
|
5/6/2010 8:42:12 AM
|
|
Hi again :
the same problem , all I want to do is to run the matlab function
this is a C code http://pastebin.com/spaa98WZ .
the only problem is to move from * mxArray to double and double a * mxArray.
The problem is this http://pastebin.com/t7Gchf4M
"Rafael Valenzuela" <ravamo@gmail.com> wrote in message <hrtvd4$s8v$1@fred.mathworks.com>...
> "James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hrsnjo$g43$1@fred.mathworks.com>...
> > "Rafael Valenzuela" <ravamo@gmail.com> wrote in message <hrsgs5$l33$1@fred.mathworks.com>...
> > > "Steven Lord" <slord@mathworks.com> wrote in message <hrsee5$a0k$1@fred.mathworks.com>...
> > > >
> > > > "Rafael Valenzuela" <ravamo@gmail.com> wrote in message
> > > > news:hrpstn$9hh$1@fred.mathworks.com...
> > > > > Thanks Seteven:
> > > > >
> > > > > I've solved, I used a mxArray but this makes me take another question as
> > > > > you can move from a mxArray to double
> > > >
> > > > Look at mxGetPr and/or mxGetData.
> > > >
> > > > --
> > > > Steve Lord
> > > > slord@mathworks.com
> > > > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > > >
> > > the same problem
> > > error using mxGetData :
> > > error: a value of type "void *" cannot be assigned to an entity of type "double"
> > > error using mxGetPr :
> > > error: a value of type "double *" cannot be assigned to an entity of type "double"
> > > this is a code
> >
> > 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
|
|
0
|
|
|
|
Reply
|
Rafael
|
5/9/2010 5:51:04 PM
|
|
"Rafael Valenzuela" <ravamo@gmail.com> wrote in message <hs6sm8$4ck$1@fred.mathworks.com>...
> Hi again :
> the same problem , all I want to do is to run the matlab function
> this is a C code http://pastebin.com/spaa98WZ .
> the only problem is to move from * mxArray to double and double a * mxArray.
> The problem is this http://pastebin.com/t7Gchf4M
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
|
|
0
|
|
|
|
Reply
|
James
|
5/11/2010 2:00:22 PM
|
|
"James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hsbntm$i6e$1@fred.mathworks.com>...
> "Rafael Valenzuela" <ravamo@gmail.com> wrote in message <hs6sm8$4ck$1@fred.mathworks.com>...
> > Hi again :
> > the same problem , all I want to do is to run the matlab function
> > this is a C code http://pastebin.com/spaa98WZ .
> > the only problem is to move from * mxArray to double and double a * mxArray.
> > The problem is this http://pastebin.com/t7Gchf4M
>
> 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
|
|
0
|
|
|
|
Reply
|
Rafael
|
5/13/2010 8:09:05 AM
|
|
|
9 Replies
862 Views
(page loaded in 0.004 seconds)
|