% DISPLAY implement terminal display for cdata object.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: DISPLAY implement terminal display for cdata object.
%
% VERSION:     $Id: display.m,v 1.19 2011/02/18 16:48:51 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = display(varargin)

  cdatas = [varargin{:}];

  txt = {};

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

    txt{end+1} = sprintf('     y:  [%dx%d], %s', size(cdatas(i).y), class(cdatas(i).y));
    txt{end+1} = sprintf('    dy:  [%dx%d], %s', size(cdatas(i).dy), class(cdatas(i).y));
    txt{end+1} = sprintf('yunits:  %s', char(cdatas(i).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
  end

  varargout{1} = txt;
end

