comparison m-toolbox/classes/@provenance/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 provenance objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: COPY makes a deep copy of the input provenance objects.
5 %
6 % CALL: b = copy(a, flag)
7 %
8 % INPUTS: a - input provenance object
9 % flag - 1: make a deep copy, 0: return copies of handles
10 %
11 % OUTPUTS: b - copy of inputs
12 %
13 % This is a transparent function and adds no history.
14 %
15 % VERSION: $Id: copy.m,v 1.13 2010/06/25 15:11:47 ingo Exp $
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 function varargout = copy(old, deepcopy)
20
21 if deepcopy
22 % Loop over input provenance objects
23 new = provenance.newarray(size(old));
24 % new = copy@ltpda_nuo(new, old, 1);
25
26 for kk=1:numel(old)
27 new(kk).creator = old(kk).creator;
28 new(kk).ip = old(kk).ip;
29 new(kk).hostname = old(kk).hostname;
30 new(kk).os = old(kk).os;
31 new(kk).matlab_version = old(kk).matlab_version;
32 new(kk).sigproc_version = old(kk).sigproc_version;
33 new(kk).symbolic_math_version = old(kk).symbolic_math_version;
34 new(kk).optimization_version = old(kk).optimization_version;
35 new(kk).database_version = old(kk).database_version;
36 new(kk).control_version = old(kk).control_version;
37 new(kk).ltpda_version = old(kk).ltpda_version;
38 end
39 else
40 new = old;
41 end
42
43 varargout{1} = new;
44 end
45