Code covered by the BSD License  

Highlights from
copymyobj

from copymyobj by Holger Hiebel
Workaround to create copies of objects inheriting from the Matlab 'handle'-class

[newobj]=copymyobj(obj)
function [newobj]=copymyobj(obj)
% COPYOBJ   Create a copy of an custom object
%   [NEWOBJ]=COPYMYOBJ(OBJ)
%   Creates a new object NEWOBJ whos properties have the same values like 
%   the original object OBJ.
% 
%   This workaround does work with PR2008b - this pre-release solves a bug
%   which used to create incomplete copies of objects on the harddrive when
%   objects with nested object definitions were saved by using the built-in
%   'save' function of Matlab R2008a.
% 
%   Copyright 2008 Dipl.-Ing. Holger Hiebel 
%   email: holger.hiebel@gmx.at

filename=strcat(pwd,filesep,'temp.mat');
save(filename,'obj');
newobj=load(filename);
newobj=newobj.obj;
delete(filename);

end

Contact us at files@mathworks.com