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일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2014년 7월 1일

답변:

2014년 7월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by