"JayTee " <firstname.lastname@example.org> wrote in message news:email@example.com... > I have an object A of a user-defined class. > A.x = 1; A.y = 2; > > Now when I let B = A, any operation on B will also change the > corresponding properties in A. So if I set B.x = 5, I get A.x = 5 as well.
That only happens if your class is a handle class, and that is the expected and desired behavior for handle classes.
If for some reason you need your object to be a handle and can't subclass from matlab.mixin.Copyable you could always write your own copy or "clone" method that decouples the original object and its copy.