23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

12 <strong>Programming</strong> Tips<br />

Debugging<br />

This section covers the following topics:<br />

• “The <strong>MATLAB</strong> Debug Functions” on page 12-22<br />

• “More Debug Functions” on page 12-22<br />

• “The <strong>MATLAB</strong> Graphical Debugger” on page 12-23<br />

• “A Quick Way to Examine Variables” on page 12-23<br />

• “Setting Breakpoints from the Command Line” on page 12-24<br />

• “Finding Line Numbers to Set Breakpoints” on page 12-24<br />

• “Stopping Execution on an Error or Warning” on page 12-24<br />

• “Locating an Error from the Error Message” on page 12-24<br />

• “Using Warnings to Help Debug” on page 12-25<br />

• “Making Code Execution Visible” on page 12-25<br />

• “Debugging Scripts” on page 12-25<br />

The <strong>MATLAB</strong> Debug Functions<br />

For a brief description of the main debug functions in <strong>MATLAB</strong>, type<br />

help debug<br />

For more information: See Debugging M-Files in the <strong>MATLAB</strong> Desktop<br />

Tools and Development Environment documentation.<br />

More Debug Functions<br />

Other functions you may find useful in debugging are listed below.<br />

Function<br />

echo<br />

disp<br />

sprintf,<br />

fprintf<br />

Description<br />

Display function or script code as it executes.<br />

Display specified values or messages.<br />

Display formatted data of different types.<br />

12-22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!