Prev: Learning Fortran
Next: Labels hidden under surface
From: Gayatri P on 20 May 2010 07:39 "Utzli Gutzli" <dont(a)send.spam.mail> wrote in message <eede5d8.3(a)webx.raydaftYaTP>... > AJ \no z\ Johnson wrote: > > > > Hi Utzli, > > I won't go into too much detail, but I will provide a list of > > functions/code > > fragments that should get you on your way. > > > > if (!mxIsCell(prhs[0])) > > mexErrMsgTxt("Need a cell array"); > > int numel = mxGetNumberOfElements(prhs[0]); > > > > % Create a cell array of equal length for the resulting data > > plhs[0] = mxCreateCellMatrix(numel,1); > > > > for (i=0; i<numel; i++) > > { > > mxArray *pArrayIn = mxGetCell(prhs[0]); > > double *pDataIn = (double *)mxGetData(pArrayIn); > > int M = mxGetM(pDataIn); // Number of rows > > int N = mxGetN(pDataIn); // Number of rows > > > > % Create an output array of the same size > > mxArray *pArrayOut = mxCreateDoubleMatrix(M,N,mxREAL); > > double *pDataOut = (double *)mxGetData(pArrayOut); > > result = MyProcessingFunction(pDataIn, M, N, pDataOut); > > > > % Stuff result in output cell array > > mxSetCell(plhs[0], i, pArrayOut); > > } > > > > I did not try compiling this, so take it at face value. > > Good luck! > > -Aj > > > > > > > > Hi Aj :-) > > Thanks a lot!! > It works. > > Thanks again, > Utzli Hey its works perfect
|
Pages: 1 Prev: Learning Fortran Next: Labels hidden under surface |