comparison m-toolbox/classes/@minfo/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 minfo objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: COPY makes a deep copy of the input minfo objects.
5 %
6 % CALL: b = copy(a, flag)
7 %
8 % INPUTS: a - input minfo 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 2011/01/04 19:03:18 ingo Exp $
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 function varargout = copy(old, deepcopy)
20
21 if deepcopy
22 % Loop over input minfo objects
23 new = minfo.newarray(size(old));
24 % new = copy@ltpda_nuo(new, old, 1);
25
26 for kk=1:numel(old)
27 new(kk).mname = old(kk).mname;
28 new(kk).mclass = old(kk).mclass;
29 new(kk).mpackage = old(kk).mpackage;
30 new(kk).mcategory = old(kk).mcategory;
31 new(kk).mversion = old(kk).mversion;
32 new(kk).description = old(kk).description;
33 new(kk).children = old(kk).children;
34 new(kk).sets = old(kk).sets;
35 new(kk).plists = old(kk).plists;
36 new(kk).argsmin = old(kk).argsmin;
37 new(kk).argsmax = old(kk).argsmax;
38 new(kk).outmin = old(kk).outmin;
39 new(kk).outmax = old(kk).outmax;
40 new(kk).modifier = old(kk).modifier;
41 end
42 else
43 new = old;
44 end
45
46 varargout{1} = new;
47 end
48