diff m-toolbox/classes/@specwin/string.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/string.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,43 @@
+% STRING writes a command string that can be used to recreate the input window object.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: STRING writes a command string that can be used to recreate the
+%              input window object.
+%
+% CALL:        cmd = string(sw)
+%
+% VERSION:     $Id: string.m,v 1.14 2011/05/23 20:33:04 mauro Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = string(varargin)
+
+  % Get specwin objects
+  sw = [varargin{:}];
+
+  if length(sw) > 1
+    cmd = '[';
+  else
+    cmd = '';
+  end
+
+  for jj = 1:length(sw)
+    switch lower(sw(jj).type)
+      case 'kaiser'
+        cmd = [cmd ' specwin(''' sw(jj).type ''', ' num2str(sw(jj).len) ', ' num2str(sw(jj).psll) ')'];
+      case 'levelledhanning'
+        cmd = [cmd ' specwin(''' sw(jj).type ''', ' num2str(sw(jj).len) ', ' num2str(sw(jj).level) ')'];
+      otherwise
+        cmd = [cmd ' specwin(''' sw(jj).type ''', ' num2str(sw(jj).len) ')'];
+    end
+  end
+
+  if length(sw) > 1
+    cmd = [cmd ']'];
+  end
+
+  % Set output
+  varargout{1} = cmd;
+
+end
+