Question

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!

Was it helpful?

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

OTHER TIPS

As you only appear to be interested in one specific value, this may also be a solution to you:

Change the c code, rather than keeping the variable internally return it at every step or store it in an array and return it to matlab after a number of steps.

This should allow for quickly checking the impact of changes in your wrapping/calling Matlab code, but of course the question remains whether one would call this debugging.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top