diff m-toolbox/classes/@cdata/char.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/@cdata/char.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,44 @@
+% CHAR convert a cdata-object into a string.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: CHAR convert a cdata object into a string.
+%
+% CALL:        string = char(fsdata)
+%
+% VERSION:     $Id: char.m,v 1.12 2011/02/18 16:48:51 ingo Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = char(varargin)
+
+  % Collect all cdata-objects
+  objs = [varargin{:}];
+  
+  %%% Add the size of the data (all)
+  pstr = sprintf('(Ndata=[%sx%s],', num2str(size(objs.y,1)), num2str(size(objs.y,2)));
+
+  %%% Add the sample rate of data (tsdata, fsdata)
+  if isprop(objs, 'fs')
+    pstr = sprintf('%s fs=%g,', pstr, objs.fs);
+  end
+
+  %%% Add the length of this time-series in seconds (tsdata)
+  if isprop(objs, 'nsecs')
+    pstr = sprintf('%s nsecs=%d,', pstr, objs.nsecs);
+  end
+
+  %%% Add number of averages (fsdata)
+  if isprop(objs, 'navs')
+    pstr = sprintf('%s navs=%d,', pstr, objs.navs);
+  end
+
+  %%% Add time-stamp of the first data sample (fsdata, tsdata)
+  if isprop(objs, 't0')
+    pstr = sprintf('%s t0=%s,', pstr, char(objs.t0));
+  end
+
+  pstr(end) = ')';
+  
+  varargout{1} = pstr;
+end
+