MATLAB Answers

copy a dynamicprops object by value

조회 수: 1(최근 30일)
Yvan Lengwiler
Yvan Lengwiler 26 Jan 2015
I've created a class that is a subclass of dynamicprops,
classdef myclass < dynamicprops
When I create an instance of this
c = myclass
and then copy this
d = c
then d and c refer to the same underlying object. Therefore, whenever I change a property of c, the corresponding property of d changes as well (because c and d really refer to the same thing).
Question 1. How can I make a "real" independent copy of c?
Question 2. Alternatively, can I adapt the class definition so that it will be copied "by value" and not "by reference" ?
Thanks for your help.

  댓글 수: 0

Sign in to comment.


Translated by