Using mexCallMATLAB to instantiate an object ?
Afficher commentaires plus anciens
Hello,
I'm trying to embed matlab into my C++ code, using the Engine API. I want to instantiate an object of a specific class ("Vector", say), and then inject that into the workspace via engPutVariable.
To instantiate the Vector, I'm trying to use
mxArray *rhs = ...; // argument
mxArray *lhs = 0;
mexCallMATLAB(1, &lhs, 1, &rhs, "Vector");
However, I'm observing a segmentation fault at the mexCallMATLAB call. Does anyone see what I'm doing wrong here ? Is there a better way to construct an instance of a specific Matlab class from C++ ?
Many thanks, Stefan
Réponse acceptée
Plus de réponses (1)
Kaustubha Govind
le 21 Juin 2011
0 votes
Have you tried following the documentation examples? As far as I know, the Engine API requires you to use engEvalString to call into functions. mexCallMATLAB is used only in MEX-functions.
Catégories
En savoir plus sur Software Development dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!