Zeta.Investigator
Zeta.Investigator

Reputation: 983

How to skip built-in functions in MATLAB debugging?

When I set a break point for debugging, the cursor "penetrates" through function angle and checks the corresponding code too. How can I force the cursor to only scan my code?
The weird thing is it doesn't do so for the functions sum or abs
Thanks

Upvotes: 2

Views: 359

Answers (1)

Shaun314
Shaun314

Reputation: 3461

The answer as to why commands like abs and sum are automatically skipped is because they are compiled, proprietary MATLAB functions that don't actually have any readable MATLAB code with them. If you do edit('angle.m') (maybe without the m, I forget) you will see the code (as expected). Now do the same for sum, and you will notice there is no MATLAB code there, just comments. The core MATLAB functions, like sum, but also like clc and close are all core embedded functions so we can't see the code.

As was mentioned earlier in the comments, the debugger has tools that allow you to just step instead of step in, and if you are stepped in one part, you can always step out to the function calling the one you are currently looking at. Also, to skip a couple lines of code at a time, the "run to cursor" can be incredibly useful!

More details can be found in the docs

Upvotes: 3

Related Questions