7

Using Memory Efficiently

After studying this chapter, you should be able to:

  • avoid “Out of Memory” errors
  • do efficient coding to improve the performance of your program
  • make use of preallocation for effective memory usage

7.1 Introduction

Efficient use of memory is essential for large-scale applications that originate in various disciplines like image processing, numerical solutions, simulations, neural network learning, and many others. Understanding memory concepts of MATLAB® can help run large programs faster and solve many “Out of Memory” errors.

We begin with a surprising note that adding more RAM or a larger hard disk might not solve “Out of Memory” problems. Each computer has a physical memory (i.e., RAM) and a portion of hard disk ...

Get Programming in MATLAB ® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.