2

I try to run and debug a script file from the matlab engine. Using breakpoints in my C++ program, I could open a Matlab editor and set a breakpoint in my script. When I continue the C++ program, the breakpoint gets hit, but Step through or similar commands do not work (as well as inspect variables or continue running). Is there any way to debug the code?

Thanks, Philipp

2 Answers 2

1

Can you clarify the relationship between Matlab and C++ in the situation you are dealing with? Because you mention C++, it seems you are not simply trying to debug a Matlab function or script using the Matlab debugger, correct?

(If you are new to Matlab and/or its debugger make sure to type 'doc debug' and familiarize yourself with the commands.)

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

2 Comments

The Matlab Engine allows to call Matlab scripts from programs written in other languages, in my case it's C++. See mathworks.com/access/helpdesk/help/techdoc/matlab_external/… for more information. (A Matlab Command Window is started when the COM connection is opened, and from this window I tried to debug.)
Oh, I see what you are trying to do. Apparently not all/almost none of the debugger features work in "engine mode"; Mathworks seems to recommend this workaround (mathworks.com/support/solutions/en/data/1-2CEUK6/…) that relies on saving the workspace and then debugging it in the full MATLAB.
0

Maybe I don't understand the question, but the Matlab editor has the usual debug command buttons like step over, into etc.

1 Comment

thanks, but the problem is that I cannot click them - nothing happens or sometimes Matlab will even crash (I've reported a bug to Mathworks for this.)

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.