Borrar filtros
Borrar filtros

Growing a Cell Array

20 visualizaciones (últimos 30 días)
Victor
Victor el 1 de Jul. de 2014
Respondida: Titus Edelhofer el 1 de Jul. de 2014
I have created a cell array of size {1,1} but what if i want to add other matrices in the array? Do i have to preallocate it or will it automatically grow as I add contents in the cell array?

Respuesta aceptada

Titus Edelhofer
Titus Edelhofer el 1 de Jul. de 2014
Hi Victor,
it will automatically grow:
x = {1}
x =
[1]
x{3} = 'Hello'
x =
[1] [] 'Hello'
Nevertheless, if the array will become large and you know the size before, preallocation, e.g. in this case
x = cell(1,3);
saves time.
Titus

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by