% DISPLAY overloads display functionality for xydata objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: DISPLAY overloads display functionality for xydata objects.
%
% CALL:        txt    = display(xy)
%
% INPUT:       xy - xydata object
%
% OUTPUT:      txt    - cell array with strings to display the xydata object
%
% VERSION:     $Id: display.m,v 1.16 2011/02/18 16:48:56 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = display(varargin)
  
  xydatas = [varargin{:}];
  
  txt = {};
  
  for i=1:numel(xydatas)
    xy = xydatas(i);
    banner = sprintf('-------- xydata %02d ------------', i);
    txt{end+1} = banner;
    
    txt{end+1} = ' ';
    
    txt{end+1} = sprintf('     x:  [%d %d], %s', size(xy(i).x), class(xy(i).x));
    txt{end+1} = sprintf('     y:  [%d %d], %s', size(xy(i).y), class(xy(i).y));
    txt{end+1} = sprintf('    dx:  [%d %d], %s', size(xy(i).dx), class(xy(i).dx));
    txt{end+1} = sprintf('    dy:  [%d %d], %s', size(xy(i).dy), class(xy(i).dy));
    txt{end+1} = sprintf('xunits:  %s', char(xy.xunits));
    txt{end+1} = sprintf('yunits:  %s', char(xy.yunits));
    
    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


