Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
argument of type "double" is incompatible with parameter of type "mxArray **"

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: Rafael Valenzuela

Date: 4 May, 2010 11:45:07

Message: 1 of 10

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>

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: Steven Lord

Date: 4 May, 2010 13:29:52

Message: 2 of 10


"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

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: Rafael Valenzuela

Date: 4 May, 2010 19:35:19

Message: 3 of 10

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
>

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: Steven Lord

Date: 5 May, 2010 18:46:33

Message: 4 of 10


"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

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: Rafael Valenzuela

Date: 5 May, 2010 19:28:06

Message: 5 of 10

"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

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: James Tursa

Date: 5 May, 2010 21:23:04

Message: 6 of 10

"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

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: Rafael Valenzuela

Date: 6 May, 2010 08:42:12

Message: 7 of 10

"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

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: Rafael Valenzuela

Date: 9 May, 2010 17:51:04

Message: 8 of 10

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

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: James Tursa

Date: 11 May, 2010 14:00:22

Message: 9 of 10

"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

Subject: argument of type "double" is incompatible with parameter of type "mxArray **"

From: Rafael Valenzuela

Date: 13 May, 2010 08:09:05

Message: 10 of 10

"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

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us