function mauifunc( val )
%MAUIFUNC Produce a short description of a variable.
%   MAUIFUNC(X) produces a short description of a variable, as for use in
%   debugger DataTips.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.7 $  $Date: 1998/05/28 19:51:15 $


if nargin ~= 1
   return
end

if isempty(val)
   disp('[]');

% The short description amounts to a summary, so we don't want
% to produce a huge amount of information.  As a rough rule of
% thumb, print the full text of the value only if the total
% number of elements is less than an arbitrary cutoff (500).
elseif prod(size(val)) <= 500
   disp(val);

% Otherwise, unless this is a simple string (in which case we
% print the first 500 characters), just print a description of
% the value (along the lines of '40x40 double array')
else
   if isstr(val)
      disp(val(1:500));
   else
      s = size(val);
      switch ndims(val)
         case 2
            fprintf('%dx%d',s(1),s(2));
         case 3
            fprintf('%dx%dx%d',s(1),s(2),s(3)');
         otherwise
            fprintf('%d-D', ndims(val));
      end

      disp([' ' class(val) ' array'])
   end
end
