Mercurial > hg > ltpda
comparison m-toolbox/classes/@ssm/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 Make copy of ssm objects depending of the second input | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: COPY Make copy of ssm objects depending of the second input | |
5 % | |
6 % CALL: objs = copy(objs, [1,0]); | |
7 % objs = copy(objs); Second input is assumed to be 1 | |
8 % | |
9 % This is a transparent function and adds no history. | |
10 % | |
11 % VERSION: $Id: copy.m,v 1.30 2010/08/18 19:40:52 adrien Exp $ | |
12 % | |
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
14 | |
15 % HISTORY: 07-08-2008 Grynagier - made second input facultative | |
16 % 11-07-2008 Diepholz | |
17 % Creation | |
18 | |
19 function varargout = copy(old, deepcopy) | |
20 | |
21 % begin function body | |
22 | |
23 if deepcopy | |
24 new = ssm.newarray(size(old)); | |
25 new = copy@ltpda_uoh(new, old, 1); | |
26 | |
27 for kk=1:numel(old) | |
28 new(kk).amats = old(kk).amats; | |
29 new(kk).bmats = old(kk).bmats; | |
30 new(kk).cmats = old(kk).cmats; | |
31 new(kk).dmats = old(kk).dmats; | |
32 new(kk).timestep = old(kk).timestep; | |
33 new(kk).inputs = copy(old(kk).inputs, 1); | |
34 new(kk).states = copy(old(kk).states, 1); | |
35 new(kk).outputs = copy(old(kk).outputs, 1); | |
36 new(kk).params = copy(old(kk).params, 1); | |
37 new(kk).numparams = copy(old(kk).numparams, 1); | |
38 end | |
39 else | |
40 new = old; | |
41 end | |
42 varargout{1} = new; | |
43 | |
44 end | |
45 | |
46 |