view m-toolbox/classes/@cdata/char.m @ 13:e05504b18072 database-connection-manager

Move more functions to utils.repository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
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