Prev: sum without transposing
Next: Problem with nlinfit
From: James Tursa on 5 May 2010 17:23 "Rafael Valenzuela" <ravamo(a)gmail.com> wrote in message <hrsgs5$l33$1(a)fred.mathworks.com>... > "Steven Lord" <slord(a)mathworks.com> wrote in message <hrsee5$a0k$1(a)fred.mathworks.com>... > > > > "Rafael Valenzuela" <ravamo(a)gmail.com> wrote in message > > news:hrpstn$9hh$1(a)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(a)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
From: Rafael Valenzuela on 6 May 2010 04:42 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hrsnjo$g43$1(a)fred.mathworks.com>... > "Rafael Valenzuela" <ravamo(a)gmail.com> wrote in message <hrsgs5$l33$1(a)fred.mathworks.com>... > > "Steven Lord" <slord(a)mathworks.com> wrote in message <hrsee5$a0k$1(a)fred.mathworks.com>... > > > > > > "Rafael Valenzuela" <ravamo(a)gmail.com> wrote in message > > > news:hrpstn$9hh$1(a)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(a)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
From: Rafael Valenzuela on 9 May 2010 13:51 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(a)gmail.com> wrote in message <hrtvd4$s8v$1(a)fred.mathworks.com>... > "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hrsnjo$g43$1(a)fred.mathworks.com>... > > "Rafael Valenzuela" <ravamo(a)gmail.com> wrote in message <hrsgs5$l33$1(a)fred.mathworks.com>... > > > "Steven Lord" <slord(a)mathworks.com> wrote in message <hrsee5$a0k$1(a)fred.mathworks.com>... > > > > > > > > "Rafael Valenzuela" <ravamo(a)gmail.com> wrote in message > > > > news:hrpstn$9hh$1(a)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(a)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
From: James Tursa on 11 May 2010 10:00 "Rafael Valenzuela" <ravamo(a)gmail.com> wrote in message <hs6sm8$4ck$1(a)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
From: Rafael Valenzuela on 13 May 2010 04:09
"James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hsbntm$i6e$1(a)fred.mathworks.com>... > "Rafael Valenzuela" <ravamo(a)gmail.com> wrote in message <hs6sm8$4ck$1(a)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 |