

I need to do this, because I am parsing a complicated MATLAB structure into my internal C data structures.
Allocate null vector matlab code#
Hence, I would assume this code is legal. The only requirement is hat the data pointer has been allocated using mxCalloc, which it obviously has. I believe nothing is said about such scenario in the documentation. I get a segfault, if not immediately, then after a few calls. * segfaults with or without the below line */

Outp = mxCreateNumericMatrix(0,0,mxDOUBLE_CLASS,mxREAL) Void mexFunction(int nargout, mxArray *pargout, int nargin, const mxArray *pargin) I would like to get the raw pointer from pargin, process it internally, and return a freshly created mex array by setting the corresponding data pointer. You could trivially do this: void mexFunction(int nargout, mxArray *pargout, int nargin, const mxArray *pargin)īut this is not what I need. In short, I would like to return from a mex file an array, which has been passed as mex function input.

I have found a really tricky problem, which I can not seem to fix easily.
