matlab - how to use mxNumericArray -
my goal homecoming uint32 number:
i have been using mexcreatedoublescalar , alter mxcreatenumericarray
the old code is
const int all_good 0; plhs[0]=mexcreatedoublescalar(all_good); the new code want
const int all_good 0; int dim[2]; dim[0]=dim[1]=1; plhs[0]=mxcreatenumericarray(2,dims,mxuint32_class,mxreal); how can set value all_good in plhs[0], or batter way homecoming uint32 mex?
you can utilize mxcreatenumericmatrix more simple general mxcreatenumericarray create container mxarray, utilize mxgetdata pointer actual memory of allocated scalar , assign value it.
const int all_good = 0; // need assignment here... plhs[0] = mxcreatenumericmatrix( 1, 1, mxuint32_class,mxreal); // create scalar unsigned int* ptr = (unsigned int*)mxgetdata( plhs[0] ); ptr[0] = all_good; // assign value plhs[0] matlab mex
No comments:
Post a Comment