1

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?

2
  • 1
    maybe try clear and re-run your code? Since i got no error with your example Commented May 28, 2015 at 10:19
  • please add the desired content of Sections for your example input. Commented May 28, 2015 at 10:46

1 Answer 1

2

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); 
Sign up to request clarification or add additional context in comments.

2 Comments

LOL thanks, you are so strict in matters of principle
Hah, not really. I corrected it just before you post the answer, as it seemed that people were confused with all the "unrelevant" code. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.