comparison m-toolbox/classes/@pzmodel/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 pzmodel objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: COPY makes a deep copy of the input pzmodel objects.
5 %
6 % CALL: b = copy(a, flag)
7 %
8 % INPUTS: a - input pzmodel 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.16 2010/06/25 15:11:48 ingo Exp $
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 function varargout = copy(old, deepcopy)
20
21 if deepcopy
22 % Loop over input pzmodel objects
23 new = pzmodel.newarray(size(old));
24 obj = copy@ltpda_tf(new, old, 1);
25
26 for kk=1:numel(old)
27 if ~isempty(old(kk).poles)
28 obj(kk).poles = copy(old(kk).poles,1);
29 else
30 obj(kk).poles = [];
31 end
32 if ~isempty(old(kk).zeros)
33 obj(kk).zeros = copy(old(kk).zeros,1);
34 else
35 obj(kk).zeros = [];
36 end
37 obj(kk).gain = old(kk).gain;
38 obj(kk).delay = old(kk).delay;
39 end
40 else
41 obj = old;
42 end
43
44 varargout{1} = obj;
45 end
46