1
votes

I want to create a {1,2} cell array, that will contain single cell value in {1,1} and several cells in {1,2}{:,1} row:

TEXT = {'-1';'432';'a';'c';'v';'-1';'-1';'14';'b';'n';'-1';'-1';'44';'m';'t';'r';'-1';'-1';'55';'o';'i';'u';'-1'};

Sections{1,1} = TEXT{5}; 
Sections{1,2}{:,1} = TEXT{3:10,1}; 

,but I get an ERROR:

The left hand side is initialized and has an empty range of indices.
However, the right hand side returned one or more results.
Error in fff (line 4)
Sections{1,2}{:,1} = TEXT{3:10,1}; % Text in the section

Ideas?

1
maybe try clear and re-run your code? Since i got no error with your example - scmg
please add the desired content of Sections for your example input. - m.s.

1 Answers

2
votes

Just use () instead of {} for the sections in (n,2):

TEXT = {'-1';'432';'a';'c';'v';'-1';'-1';'14';'b';'n';'-1';'-1';'44';'m';'t';'r';'-1';'-1';'55';'o';'i';'u';'-1'};

Sections{1,1} = TEXT{5}; 
Sections{1,2} = TEXT(3:10,1);