view m-toolbox/classes/@tsdata/display.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

% DISPLAY overloads display functionality for tsdata objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: DISPLAY overloads display functionality for tsdata objects.
%
% CALL:        txt    = display(tsdata)
%
% INPUT:       tsdata - tsdta object
%
% OUTPUT:      txt    - cell array with strings to display the tsdata object
%
% VERSION:     $Id: display.m,v 1.28 2011/07/05 06:35:10 mauro Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = display(varargin)

  tsdatas = [varargin{:}];

  txt = {};

  for i=1:numel(tsdatas)
    ts = tsdatas(i);
    banner = sprintf('-------- tsdata %02d ------------', i);
    txt{end+1} = banner;

    txt{end+1} = ' ';

    xdata = ts.x;
    ydata = ts.y;
    dxdata = ts.dx;
    dydata = ts.dy;
    yinfo = size(ydata);
    if ~isempty(xdata)
      xinfo = size(xdata);
    else
      xinfo = yinfo;
    end
    dxinfo = size(ts.dx);
    dyinfo = size(ts.dy);

    txt{end+1} = sprintf('     fs:  %0.9g', ts.fs);
    txt{end+1} = sprintf('      x:  [%d %d], %s', xinfo, class(xdata));
    txt{end+1} = sprintf('      y:  [%d %d], %s', yinfo, class(ydata));
    txt{end+1} = sprintf('     dx:  [%d %d], %s', dxinfo, class(xdata));
    txt{end+1} = sprintf('     dy:  [%d %d], %s', dyinfo, class(ydata));
    txt{end+1} = sprintf(' xunits:  %s', char(ts.xunits));
    txt{end+1} = sprintf(' yunits:  %s', char(ts.yunits));
    txt{end+1} = sprintf('  nsecs:  %g', ts.nsecs);
    txt{end+1} = sprintf('     t0:  %s', char(ts.t0));

    banner_end(1:length(banner)) = '-';
    txt{end+1} = banner_end;

    txt{end+1} = ' ';
  end

  if nargout == 0
    for ii=1:length(txt)
      disp(txt{ii});
    end
  elseif nargout == 1
    varargout{1} = txt;
  end

end