diff m-toolbox/classes/@specwin/copy.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@specwin/copy.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,42 @@
+% COPY makes a (deep) copy of the input specwin objects.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: COPY makes a deep copy of the input specwin objects.
+%
+% CALL:        b = copy(a, flag)
+%
+% INPUTS:      a    - input specwin object
+%              flag - true: make a deep copy, false: return copies of handles
+%
+% OUTPUTS:     b - copy of inputs
+%
+% VERSION:     $Id: copy.m,v 1.14 2011/05/23 20:28:34 mauro Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = copy(old, deepcopy)
+  
+  if deepcopy
+    % Loop over input specwin objects
+    new = specwin.newarray(size(old));
+    
+    for kk = 1:numel(old)
+      new(kk).type        = old(kk).type;
+      new(kk).alpha       = old(kk).alpha;
+      new(kk).psll        = old(kk).psll;
+      new(kk).rov         = old(kk).rov;
+      new(kk).nenbw       = old(kk).nenbw;
+      new(kk).w3db        = old(kk).w3db;
+      new(kk).flatness    = old(kk).flatness;
+      new(kk).len         = old(kk).len;
+      new(kk).levelorder  = old(kk).levelorder;
+      new(kk).skip        = old(kk).skip;
+
+    end
+  else
+    new = old;
+  end
+  
+  varargout{1} = new;
+end
+