view m-toolbox/classes/@data2D/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 source

% CHAR convert a ltpda_data-object into a string.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: CHAR convert a ltpda_data object into a string.
%
% CALL:        string = char(fsdata)
%
% VERSION:     $Id: char.m,v 1.8 2011/06/15 11:25:01 hewitson Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = char(varargin)

  % Collect all ltpda_data-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

  %%% Add time-stamp of the first data sample (fsdata, tsdata)
  if isprop(objs, 'yunits')
    pstr = sprintf('%s yunits=%s,', pstr, char(objs.yunits));
  end
  
  pstr = pstr(1:end-1);

  varargout{1} = pstr;
end