Matlab shuts down after executing a mex call
이전 댓글 표시
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?
채택된 답변
추가 답변 (2개)
Walter Roberson
2012년 3월 4일
0 개 추천
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
Vimal
2012년 3월 5일
Walter Roberson
2012년 3월 5일
Try posting code. James is pretty good at spotting mex problems if he has code to work with.
Vimal
2012년 3월 5일
Vimal
2012년 3월 5일
Walter Roberson
2012년 3월 5일
0 개 추천
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
Vimal
2012년 3월 5일
Walter Roberson
2012년 3월 5일
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.
카테고리
도움말 센터 및 File Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!