Rank: 112881 based on 0 downloads (last 30 days) and 0 file submitted

Barry Ridge


Personal Profile:

PhD student.


Watch this Author's files


Comments and Ratings by Barry Ridge
Updated File Comments Rating
03 Jun 2010 Clone Handle Object - using MATLAB OOP How to clone an object (deep copy) which inherits reference behaviour from the 'handle' class. Author: Bobby Nedelkovski

I came up with a bit of a hack for doing this. It uses file-handling, and therefore is not so elegant, but it seems to work. Just add this method to whatever class you want to copy:

function new = copy(this)
save('temp.mat', 'this');
Foo = load('temp.mat');
new = Foo.this;

Example usage (assumes copy() is a method in class MyClass):
A = MyClass();
B = A.copy();

Contact us