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 1984-2000 The MathWorks, Inc. 
%   $Revision: 5.16 $  $Date: 2000/06/01 15:23:36 $

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
