title: Returning C struct through mex-function
body: <p>I am trying to return a struct created in mex function to matlab. Now there is a function <code>mxCreateStructArray</code> but I am creating a node-type structure for a tree data structure and thus it is a recursive linked list formed. Also, the nodes are formed by dynamic memory allocation. So, it is not possible for me to preallocate the memory. I am at a loss as to how I can transport this struct formed to matlab-type struct as output of the function.</p>