Growing a Cell Array

6 次查看(过去 30 天)
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?

采纳的回答

Titus Edelhofer
Titus Edelhofer 2014-7-1
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by