Ok guys, I feel as if I'm falling into the rabbit hole...
To build an interface as a Matlab-Mex that receives several different messages which consist of complicated C-structs, I want to create the corresponding Mex-Structs each in different functions.
Is it somehow possible to pass 'mxArrays' that contain fields from user defined functions to the 'mexFunction()'?
I created functions that should be called inside of 'mexFunctions()' that should pass filled 'mxArray' Datatypes to the 'mexFunction()' as pointers but that didn't work.
E.g.
mxArray* createFoo();
Or
void createFoo(mxArray* myData);
Inside the 'mexFunction()' these 'createFoo()' functions couldn't pass the created data pointers back to the function. Inside them, creating of data did work, but the pointers they returned changed mysteriously because of e.g. 'myData = mxCreateDoubleMatrix()'.
The Compiler is Visual Studio 2010.
It would be possible to directly write to workspace inside the functions, but that is very bad style.
Aucun commentaire:
Enregistrer un commentaire