view m-toolbox/classes/@cdata/char.m @ 44:409a22968d5e
default
Add unit tests
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Tue, 06 Dec 2011 18:42:11 +0100 (2011-12-06)
parents
f0afece42f48
children
line source
+ − % 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
+ −