As far as I know, there is no way to prevent the loss of Matlab by mex error. But you can connect the debugger to the Matlab process and execute the code.
I know this works if your code is in an external dll that you upload to Matlab. I'm not sure if this works with mex files.
Dima
source share