function s = int2str(x)
%INT2STR Convert integer to string.
%   S = INT2STR(X) rounds the elements of the matrix X to
%   integers and converts the result into a string matrix.
%
%   See also NUM2STR, SPRINTF, FPRINTF.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 5.14 $  $Date: 1997/11/21 23:47:18 $

x = round(real(x));
if length(x) == 1
   s = sprintf('%.1f',x);
   if (~strcmp(s, 'Inf') & ~strcmp(s, 'NaN'))
     s(end-1:end) = [];
   end
else
   [m,n] = size(x);
   d = max(1,max(ceil(log10(abs(x(:))+(x(:)==0)))));
   f = ['%' sprintf('%d',d+4) '.1f'];
   s = '';
   for i = 1:m
      t = [];
      for j = 1:n
         t = [t sprintf(f,x(i,j))];
         t(end-1:end) = [];
      end
      s = [s; t];
   end
   if ~isempty(s)
      while all(s(:,1) == ' '), s(:,1) = []; end
   end
end
