Mercurial > hg > ltpda
comparison m-toolbox/classes/@pz/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 pz objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: COPY makes a deep copy of the input pz objects. | |
5 % | |
6 % CALL: b = copy(a, flag) | |
7 % | |
8 % INPUTS: a - input pz 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 pz objects | |
23 new = pz.newarray(size(old)); | |
24 % new = copy@ltpda_nuo(new, old, 1); | |
25 | |
26 for kk=1:numel(old) | |
27 new(kk).f = old(kk).f; | |
28 new(kk).q = old(kk).q; | |
29 new(kk).ri = old(kk).ri; | |
30 end | |
31 else | |
32 new = old; | |
33 end | |
34 | |
35 varargout{1} = new; | |
36 end | |
37 |