23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Testing the Validity of a Timer Object ................. 10-23<br />

Deleting All Existing Timer Objects .................. 10-23<br />

Finding All Timer Objects in Memory ................ 10-24<br />

Finding Invisible Timer Objects ...................... 10-24<br />

11<br />

Improving Performance and Memory Usage<br />

Analyzing Your Program’s Performance ............. 11-2<br />

The M-File Profiler Utility .......................... 11-2<br />

Stopwatch Timer Functions ......................... 11-2<br />

Techniques for Improving Performance ............. 11-4<br />

MultithreadedComputationin<strong>MATLAB</strong> .............. 11-4<br />

Vectorizing Loops ................................. 11-4<br />

Preallocating Arrays ............................... 11-7<br />

Coding Loops inaMEX-File ......................... 11-9<br />

Assigning to Variables ............................. 11-9<br />

Operating on Real Data ............................ 11-10<br />

Using Appropriate Logical Operators ................. 11-10<br />

Overloading Built-In Functions ...................... 11-11<br />

Functions Are Generally Faster Than Scripts ........... 11-11<br />

Load and Save Are Faster Than File I/O Functions ...... 11-11<br />

Avoid Large Background Processes ................... 11-11<br />

Using Memory Efficiently .......................... 11-12<br />

Memory Allocation for Arrays ....................... 11-12<br />

Data Structures and Memory ........................ 11-16<br />

Memory Management Functions ..................... 11-17<br />

Strategies for Efficient Use of Memory ................ 11-18<br />

Resolving “Out of Memory” Errors .................. 11-21<br />

General Suggestions for Reclaiming Memory ........... 11-21<br />

Compressing Data in Memory ....................... 11-22<br />

Increasing System Swap Space ...................... 11-22<br />

Freeing Up System Resources on Windows Systems ..... 11-23<br />

Reloading Variables on UNIX Systems ................ 11-23<br />

xix

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

Saved successfully!

Ooh no, something went wrong!