Matlab shuts down after executing a mex call
Mostrar comentarios más antiguos
Hi,
I'm calling a C++ function using Mex. The function call works fine. After the file is called and the result is displayed, Matlab shuts down by itself. How do I stop this from happening?
Respuesta aceptada
Más respuestas (2)
Walter Roberson
el 4 de Mzo. de 2012
0 votos
You probably have some memory corruption in the C++ function, with the effect of the corruption being observed when MATLAB goes to clear the variables that are no longer being used.
4 comentarios
Vimal
el 5 de Mzo. de 2012
Walter Roberson
el 5 de Mzo. de 2012
Try posting code. James is pretty good at spotting mex problems if he has code to work with.
Vimal
el 5 de Mzo. de 2012
Vimal
el 5 de Mzo. de 2012
Walter Roberson
el 5 de Mzo. de 2012
0 votos
What do you do with the value you return from test() at the C level ? You are not somehow putting it in the the output location x (plhs[0]) in your mexFunction routine .
2 comentarios
Vimal
el 5 de Mzo. de 2012
Walter Roberson
el 5 de Mzo. de 2012
True that test() at your C level could return void, but at the MATLAB level you have indicated that you are expecting a return value from the call to the MEX routine, and you never set the return value to anything.
Categorías
Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!