Mercurial > hg > ltpda
comparison m-toolbox/classes/@ltpda_uoh/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 copies all fields of the ltpda_uoh class to the new object. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: COPY copies all fields of the ltpda_uoh class to the new | |
5 % object. | |
6 % | |
7 % CALL: b = copy(new, old, flag) | |
8 % | |
9 % INPUTS: new - new object which should be created in the sub class. | |
10 % old - old object | |
11 % flag - 1: make a deep copy, 0: return copies of handles | |
12 % | |
13 % OUTPUTS: b - copy of inputs | |
14 % | |
15 % VERSION: $Id: copy.m,v 1.4 2010/06/24 14:17:32 ingo Exp $ | |
16 % | |
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
18 | |
19 function varargout = copy(new, old, deepcopy) | |
20 | |
21 if deepcopy | |
22 obj = copy@ltpda_uo(new, old, 1); | |
23 | |
24 for kk = 1:numel(obj) | |
25 %%% copy all fields of the ltpda_uoh class | |
26 obj(kk).hist = old(kk).hist; | |
27 if ~isempty(old(kk).procinfo) | |
28 obj(kk).procinfo = copy(old(kk).procinfo,1); | |
29 end | |
30 if ~isempty(old(kk).plotinfo) | |
31 obj(kk).plotinfo = copy(old(kk).plotinfo,1); | |
32 end | |
33 end | |
34 | |
35 else | |
36 obj = old; | |
37 end | |
38 | |
39 varargout{1} = obj; | |
40 end |