MATLAB Answers

Is it possible to save an object to a structure field?

1 view (last 30 days)
I am interested to put an object into a structure field like:
struct.field=object;
is it possible?

  1 Comment

Rik
Rik on 27 Apr 2020
Why wouldn't it be? And why didn't you just try it?

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 27 Apr 2020
Edited: Ameer Hamza on 27 Apr 2020
Definitely possible
>> fig = figure;
>> myStruct.a = fig
myStruct =
struct with fields:
a: [1×1 Figure]

  0 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by