On Dec 19, 2007, at Dec 19:5:07 AM, [EMAIL PROTECTED] wrote:

help please

how can i pass 3d matrix from matlab to c

using mex file

thanks
-- http://mail.python.org/mailman/listinfo/python-list


wrong mailing list, you might want to try the matlab news group. but, to answer your question, mex files all have the same syntax:

void mexFunction(
                 int nlhs,        /* number of expected outputs */
mxArray *plhs[], /* mxArray pointer array returning outputs */
                 int nrhs,        /* number of inputs */
const mxArray *prhs[] /* mxArray pointer array for inputs */
                 )


no matter what type of array you pass. you then need to get the data pointer, the sizes for the arrays, etc... like:


mydata  = mxGetPr(prhs[0]);
dims=mxGetDimensions(prhs[0]);
ndims=mxGetNumberOfDimensions(prhs[0]);


check out the mex documentation.

Or, you can use Python with numpy for matrices, and use Pyrex for the c-extensions and make your life a *lot* easier.



                                bb




--
Brian Blais
[EMAIL PROTECTED]
http://web.bryant.edu/~bblais


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to