Community Highlights Follow
What is your main tool or approach for debugging MATLAB code?
disp('Got this far no29') works pretty well ;)
Joking aside, "Pause on Errors" has worked best for me - when it works. 9/10 times it does not trigger on an error for me. How do you guys get it to work?
It only works if the error is not being caught by some try/catch block. To also pause on caught errors, follow these steps (Matlab 2016b): 1. in the "Editor" tab, open the menu below "Breakpoints" by pressing the arrow down 2. click "More Error and Warning Handling Options" 3. select tab "Try/Catch Errors" 4. select the second or third option
I wonder what the "Other" methods are that people are using. The score in that category is higher than I expected.
The best one is the live script.
I have a simple 4-step approach that usually works.
- get so mad that steam comes out of my ears
- slam face on keyboard like a cartoon character
- roll around on the floor screaming obscenities
- troubleshoot the problem and fix it i guess
I hope that someone finds this helpful.
dbstop if error can help me locate the place the code bombs, but working backwards from there to locate the cause of the error is mostly breakpoints... and fprintf.
Some older releases don't automatically open the file and move the cursor if you use keyboard, so I use the line below on such releases. It works without incident (even on GNU Octave), as long as I never cd.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!