view m-toolbox/classes/@ltpda_data/copy.m @ 28:01b86b780ba7
database-connection-manager
Remove LTPDARepositoryManager implementation. Java code
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − % COPY copies all fields of the ltpda_data class to the new object.
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % DESCRIPTION: COPY copies all fields of the ltpda_data class to the new
+ − % object.
+ − %
+ − % CALL: b = copy(new, old, flag)
+ − %
+ − % INPUTS: new - new object which should be created in the sub class.
+ − % old - old object
+ − % flag - 1: make a deep copy, 0: return copies of handles
+ − %
+ − % OUTPUTS: b - copy of inputs
+ − %
+ − % VERSION: $Id: copy.m,v 1.2 2011/02/14 19:25:14 ingo Exp $
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ −
+ − function varargout = copy(new, old, deepcopy)
+ −
+ − if deepcopy
+ − new = copy@ltpda_nuo(new, old, 1);
+ −
+ − for kk = 1:numel(new)
+ − %%% copy all fields of the ltpda_data class
+ − new(kk).yunits = copy(old(kk).yunits,1);
+ − new(kk).y = old(kk).y;
+ − new(kk).dy = old(kk).dy;
+ − end
+ − obj = new;
+ −
+ − else
+ − obj = old;
+ − end
+ −
+ − varargout{1} = obj;
+ − end