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.

4 M-File <strong>Programming</strong><br />

Improving Performance<br />

The <strong>MATLAB</strong> Profiler generates a report that shows how your program<br />

spends its processing time. For details about using the <strong>MATLAB</strong> Profiler,<br />

see Profiling for Improving Performance in the <strong>MATLAB</strong> Desktop Tools and<br />

Development Environment documentation. For tips on other ways to improve<br />

the performance of your programs, see Chapter 11, “Improving Performance<br />

and Memory Usage”.<br />

Three types of reports are available:<br />

• “Summary Report” on page 4-6<br />

• “Detail Report” on page 4-6<br />

• “File Listing” on page 4-6<br />

Summary Report<br />

The summary report provides performance information on your main program<br />

and on every function it calls. This includes how many times each function is<br />

called, the total time spent in that function, along with a bar graph showing<br />

therelativetimespentbyeachfunction.<br />

Detail Report<br />

When you click a function name in the summary report, <strong>MATLAB</strong> displays a<br />

detailed report on that function. This report shows the lines of that function<br />

that take up the most time, the time spent executing that line, the percentage<br />

of total time for that function that is spent on that line, and a bar graph<br />

showing the relative time spent on the line.<br />

File Listing<br />

The detail report for a function also displaystheentireM-filecodeforthat<br />

function. This listing enables you to view the time-consuming code in the<br />

context of the entire function body. For every line of code that takes any<br />

significant time, additional performance information is provided by the<br />

statistics and by the color and degree of highlighting of the program code.<br />

4-6

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

Saved successfully!

Ooh no, something went wrong!