Join Patrick Royal for an in-depth discussion in this video Debugging, part of Learning MATLAB.
Even the best coder, is unlikely to write a script that runs perfectly the first …time, and coding in MATLAB is no exception. …To help with debugging, MATLAB provides several different methods of getting a …closer look at the mechanics of your functions as they run so that the problem …can be identified. The simplest step to take when a bug is …encountered is to remove the semicolons from every line in the suspect area. …This causes MATLAB to display the output from every single calculation, …potentially allowing you to spot the problem.…
In fact, unless you have a long loop with lots of data that can't be displayed …easily, there's no reason not to leave off semicolons entirely, at least until …the program is working to your specifications. …If that doesn't solve the problem, the next step is to run the program in …sections by specifying breakpoints. Breakpoints can be added from within the …Editor Window, so we'll open up the practice script that we worked on in an …earlier video, so we can add them now. Breakpoints are added in the Breakpoints …
- Installing MATLAB
- Working with MATLAB variables
- Working with matrix and scalar operations
- Creating functions
- Understanding performance considerations
- Building basic plots
- Creating responsive programs
- Editing variables manually
- Working with the Statistics Toolbox
Skill Level Intermediate
1. General Concepts
2. Core MATLAB Syntax
3. Programming in MATLAB
4. Data Representations
5. External Toolboxes
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.