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.

1

1 Answer 1

1

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

g{1,2}.name
Sign up to request clarification or add additional context in comments.

Comments

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.