
519Memory-Related Techniques
9.7 Additional Recommendations
9.7.1 MATLAB Variables
Some recommendations that appeared in earlier chapters are also related to memory man-
agement, and are therefore repeated here. Some of these can be found in MATLAB’s of-
cial guide Strategies for efcient use of memory.
1553
Load, process, and save only as much data as you really need, not all of it (see §3.6).
Avoid the form a(:) or d a t a(:,:), but rather use a and data as is, without the (:) parts.
Adding these full-index notations forces MATLAB to unnecessarily parse the data, which
degrades performance:
*
a = rand(1000);
b = rand(1000);
tic; c = a*b;