Mercurial > hg > ltpda
comparison m-toolbox/classes/@pest/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 pest objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: COPY makes a deep copy of the input pest objects. | |
5 % | |
6 % CALL: b = copy(a, flag) | |
7 % | |
8 % INPUTS: a - input pest 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.4 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 pest objects | |
23 new = pest.newarray(size(old)); | |
24 obj = copy@ltpda_uoh(new, old, 1); | |
25 | |
26 for kk=1:numel(old) | |
27 | |
28 if ~isempty(old(kk).yunits) | |
29 obj(kk).yunits = old(kk).yunits; | |
30 end | |
31 if ~isempty(old(kk).models) | |
32 obj(kk).models = old(kk).models; | |
33 end | |
34 | |
35 obj(kk).y = old(kk).y; | |
36 obj(kk).dy = old(kk).dy; | |
37 obj(kk).names = old(kk).names; | |
38 obj(kk).pdf = old(kk).pdf; | |
39 obj(kk).cov = old(kk).cov; | |
40 obj(kk).corr = old(kk).corr; | |
41 obj(kk).chi2 = old(kk).chi2; | |
42 obj(kk).dof = old(kk).dof; | |
43 obj(kk).chain = old(kk).chain; | |
44 | |
45 end | |
46 else | |
47 obj = old; | |
48 end | |
49 | |
50 varargout{1} = obj; | |
51 end | |
52 |