MATLAB encountered an internal error and needs to close

First of all, I am aware that there is a similar question here, but I read it and it concerns a different problem. Moving on to my problem, every time I am compiling a C file which is used from a function I get the error "MATLAB encountered an internal problem and needs to close". The compiling is done successfully by "Clang" on Mavericks OS X. Here is a screenshot of the error. More details (Matlab report etc.) can be, of course, provided upon request if one needs them to resolve the error. Screenshot

The files can also be provided.


  • That error is not because of the compiler. It is due to a segmentation fault once you run the MEX code. Somewhere in that code, you are accessing memory that you shouldn't be allowed to access.

    I suggest you debug your MATLAB code. Check out my post here to figure out how to debug your MEX code depending on your operating system.

    Preventing a MEX file from crashing in MATLAB