Skip to main content Accessibility help
×
Hostname: page-component-8448b6f56d-wq2xx Total loading time: 0 Render date: 2024-04-19T08:44:44.250Z Has data issue: false hasContentIssue false

11 - Troubleshooting

Published online by Cambridge University Press:  05 September 2012

Brian R. Hunt
Affiliation:
University of Maryland, College Park
Ronald L. Lipsman
Affiliation:
University of Maryland, College Park
Jonathan M. Rosenberg
Affiliation:
University of Maryland, College Park
Kevin R. Coombes
Affiliation:
University of Texas, M. D. Anderson Cancer Center
John E. Osborn
Affiliation:
University of Maryland, College Park
Garrett J. Stuck
Affiliation:
University of Maryland, College Park
Get access

Summary

In this chapter, we offer advice for dealing with some common problems that you may encounter. We also list and describe the most common mistakes that MATLAB users make. Finally, we offer some simple but useful techniques for debugging your M-files.

Common Problems

Problems manifest themselves in various ways: totally unexpected or plainly wrong output appears; MATLAB produces an error message (or at least a warning); MATLAB refuses to process an input line; something that worked earlier stops working; or, worst of all, the computer freezes. Fortunately, these problems are often caused by several easily identifiable and correctable mistakes. What follows is a description of some common problems, together with a presentation of likely causes, suggested solutions, and illustrative examples. We also refer to places in the book where related issues are discussed.

Here is a list of the problems:

  • Wrong or unexpected output

  • Syntax error

  • Spelling error

  • Error or warning messages when plotting

  • A previously saved M-file evaluates differently

  • Computer won't respond.

Wrong or Unexpected Output

There are many possible causes for this problem, but they are likely to be among the following.

CAUSE: Forgetting to clear or reset variables.

SOLUTION: Clear or initialize variables before using them, especially in a long session.

Type
Chapter
Information
A Guide to MATLAB
For Beginners and Experienced Users
, pp. 205 - 218
Publisher: Cambridge University Press
Print publication year: 2006

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×