Search code examples
cmatlabdebuggingmex

Matlab: debugging C library, is it possible?


I have a Matlab code which uses a function called foo.

This function has been written in C (foo.c being the original file) and compiled in order to generate a Matlab library called foo.mexa64.

The code runs successfully.

My question is: Is there any way to debug this function foo within Matlab?

I need to know, step by step, some local value inside foo function!


Solution

  • Not it's not possible using only MATLAB.

    I haven't tried, but it is possible using general purpose c/c++ debuggers. Mathworks has a pretty detailed documentation on how to do this:

    http://www.mathworks.de/de/help/matlab/matlab_external/debugging-c-c-language-mex-files.html