function s = i4_to_unary ( intval )

%*****************************************************************************80
%
%% i4_to_unary() produces the "base 1" representation of an integer.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    24 March 2006
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer INTVAL, an integer to be represented.
%
%  Output:
%
%    string S, the unary representation.
%
  if ( intval == 0 )
    s = '0';
  elseif ( intval < 0 )
    s(1) = '-';
    s(2:1-intval) = '1';
  else
    s(1:intval) = '1';
  end

  s = char ( s );

  return
end
