2

When I'm debugging MATLAB code, if I call dbstep when the next statement is a function call, the debugger skips over the function call to the next line of code in the current m file. How can I step into the function call? I'm looking for a function like next in gdb.

Example

Source file:

=> b = foo(a);
   c = bar(b);

I call dbstep:

   b = foo(a);
=> c = bar(b);

What I want:

   function out = foo (a)
=>     out = baz(a);

2 Answers 2

8

The MATLAB alternative to gdb's next command is dbstep in.

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

Comments

4

Another option, if you are using the GUI is to learn the keyboard shortcuts, which have been really helpful to me for stepping through code.

Once you are in debug mode, using F10 will step line by line through your current file. If you want to step in to a function just use F11. Step out is shift+F11 and F5 will run to the end.

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.