Matlab shuts down after executing a mex call
Ältere Kommentare anzeigen
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?
Akzeptierte Antwort
Weitere Antworten (2)
Walter Roberson
am 4 Mär. 2012
0 Stimmen
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 Kommentare
Vimal
am 5 Mär. 2012
Walter Roberson
am 5 Mär. 2012
Try posting code. James is pretty good at spotting mex problems if he has code to work with.
Vimal
am 5 Mär. 2012
Vimal
am 5 Mär. 2012
Walter Roberson
am 5 Mär. 2012
0 Stimmen
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 Kommentare
Vimal
am 5 Mär. 2012
Walter Roberson
am 5 Mär. 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.
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!