Mercurial > hg > ltpda
comparison m-toolbox/classes/@ssmport/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 ssmport objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: COPY makes a deep copy of the input ssmport objects. | |
5 % | |
6 % CALL: b = copy(a, flag) | |
7 % | |
8 % INPUTS: a - input ssmport 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.9 2011/02/21 14:23:01 hewitson Exp $ | |
16 % | |
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
18 | |
19 function varargout = copy(old, deepcopy) | |
20 | |
21 if deepcopy | |
22 % Loop over input ssmport objects | |
23 new = ssmport.newarray(size(old)); | |
24 | |
25 for kk=1:numel(old) | |
26 new(kk).name = old(kk).name; | |
27 | |
28 if isempty(old(kk).units) | |
29 else | |
30 new(kk).units = copy(old(kk).units, 1); | |
31 end | |
32 | |
33 new(kk).description = old(kk).description; | |
34 end | |
35 else | |
36 new = old; | |
37 end | |
38 | |
39 varargout{1} = new; | |
40 end | |
41 |