comparison m-toolbox/classes/@plist/copy.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % COPY makes a (deep) copy of the input plist objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: COPY makes a deep copy of the input plist objects.
5 %
6 % CALL: b = copy(a, flag)
7 %
8 % INPUTS: a - input plist object
9 % flag - true: make a deep copy, false: return copies of handles
10 %
11 % OUTPUTS: b - copy of inputs
12 %
13 %
14 % VERSION: $Id: copy.m,v 1.18 2011/05/23 20:41:12 mauro Exp $
15 %
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
18 function varargout = copy(old, deepcopy)
19
20 if deepcopy
21 % Loop over input plist objects
22 new = plist.newarray(size(old));
23 obj = copy@ltpda_uo(new, old, true);
24
25 for kk = 1:numel(old)
26 if ~isempty(old(kk).params)
27 obj(kk).params = copy(old(kk).params, true);
28 end
29 end
30 else
31 obj = old;
32 end
33
34 varargout{1} = obj;
35 end
36