Friday, 21 November 2014

How to stop Matlab at the point of error for debugging?

1. There is an useful command 'dbstop'. Check help for more details.

2. To stop the control at the point of error in part of the function or the script use

dbstop if error

3. This has to be only once in the file. It gets applied to all the files.

4. Quite useful. Avoids rerunning the script to look for the reasons for the errors. It stops the control at the line where error is encountered and retains the work-space variables that belong to that function.


No comments:

Post a Comment