llz
llz

Reputation: 1

Matlab:How to define a dynamic cell array in Matlab?

I need to store some vectors,but i don't kown how many vectors.I want to ask is there exits cell array with undefined size that means denamic cell arrays in Matlab?Or can i only predefine a very large cell array to meet my demand?

Upvotes: 0

Views: 244

Answers (1)

Tasos Papastylianou
Tasos Papastylianou

Reputation: 22225

All arrays in matlab are 'dynamic' (i.e. resizeable)

>> a = [1,2,3]
a =
     1     2     3

>> a(7) = 7
a =
     1     2     3     0     0     0     7

Same with cell arrays:

>> b = {1,2,3}; b{7} = 7
b = 
    [1]    [2]    [3]    []    []    []    [7]

Upvotes: 2

Related Questions