I'm using Matlab 2012a and I'm trying out map containers and I came across what I think is a bug. I have a variable which is a structure and one of the elements in this structure is a map container. I want to make a copy of the map container and make it a new element in the structure. I then update a value on one of the container values and I find that both containers are updated with the new value.
For example:
X = 10;
Test.Obj1 = containers.Map({'X'},{X});
when I examine the contents, Test.Obj1('X'), I get 10. Now I make a new container and set it equal to the Obj1 container
Obj2 = Test.Obj1;
Now change the value in this new container
Obj2('X') = 20;
Now if I examine Test.Obj1('X') it now equals 20 instead of 10.
Is this a bug or am I misunderstanding containers?
Thanks!