How do concatenation and indexing differ for cells and arrays in MATLAB?
问题 I am a little confused about the usage of cells and arrays in MATLAB and would like some clarification on a few points. Here are my observations: An array can dynamically adjust its own memory to allow for a dynamic number of elements, while cells seem to not act in the same way: a=[]; a=[a 1]; b={}; b={b 1}; Several elements can be retrieved from cells, but it doesn't seem like they can be from arrays: a={'1' '2'}; figure; plot(...); hold on; plot(...); legend(a{1:2}); b=['1' '2']; figure;