1

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!

1
  • 1
    maybe we should not think it is matlab program ,it s a c program which depend on some libraries in matlab, I used to debug with vc. Commented Jan 22, 2014 at 12:12

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.