# Doug's MATLAB Video Tutorials

## Example: Speed up MATLAB code by profiling

Sometimes the performance of MATLAB code can depend greatly on the algorithm or the specific functions called. In this example, we show how we use the profiler (and good knowledge of logical indexing in MATLAB) to speed up some MATLAB code by nearly a factor of ten.

 Name (required) E-mail (required, will not be published) Website (optional) Spam protection (required): What is 3 + 6 ?

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>


If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).

Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.

These postings are the author's and don't necessarily represent the opinions of MathWorks.