Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

Preallocate Memory for Cell Array

This example shows how to initialize and allocate memory for a cell array.

Cell arrays do not require completely contiguous memory. However, each cell requires contiguous memory, as does the cell array header that MATLAB® creates to describe the array. For very large arrays, incrementally increasing the number of cells or the number of elements in a cell results in Out of Memory errors.

Initialize a cell array by calling the cell function, or by assigning to the last element. For example, these statements are equivalent:

C = cell(25,50);
C{25,50} = [];

MATLAB creates the header for a 25-by-50 cell array. However, MATLAB does not allocate any memory for the contents of each cell.

See Also

Related Topics

Was this topic helpful?