Put data into a matrix contained in a cell

I made the following cell:
Grid={1,1,1,1,1,1,[2,2]}
and was under the impression that the [2,2] term in position 7 in the cell was a 2x2 matrix. When I try to put values into the cell, ie:
Grid={1,1,1,1,1,1,[1,1]}='methanol'
I get the following error: The right hand side of this assignment has too few values to satisfy the left hand side.
This leads me to believe that the [2,2] in my cell assignment does not actually create a matrix in the cell, but does something else entirely. No matter how many values I try to feed on the right hand side of the above, I still get the error.
Can anyone enlighten me?
Thanks!

 Accepted Answer

Your expression is not correct, you cant write
A=B=C
Why do you think that [2,2] is a 2x2 matrix? obviously, it's a 1x2 vector
Can you explain what are you expecting as result?

1 Comment

Maybe you want
Grid=cell(1,7)
Grid{7}=cell(2,2)
Grid(1:6)={'methanol'}
Grid{7}(1,1:2)={'methanol'}

Sign in to comment.

More Answers (1)

Grid = {1, 1, 1, 1, 1, 1, cell(2,2}};
Grid = {7}{1,1} = 'methanol';

Categories

Products

Community Treasure Hunt

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

Start Hunting!