0

It might be easy question for you guys, but I am new in Matlab. I have this code :

g = cell(2,3);
g{1,2} = struct('name','joni');
g{2,2} = cell(3,3)
g(1,2)

I want to display 'joni' in the answer, but with this code it only shows [1x1 struct].

BTW I already tried this code :

g(1,2).name

and the result is error.

Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
  • related question: [Difference between accessing cell elements using {} and () (curly braces vs. parentheses)](http://stackoverflow.com/questions/9055015) – Eitan T Sep 30 '13 at 06:57

1 Answers1

1

Use curly braces instead of parentheses to refer to the content of a cell:

g{1,2}.name
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147