function xs = scale_01 ( x )

%*****************************************************************************80
%
%% SCALE_01 scales the columns of an array to [0,1].
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    07 October 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real X(M,N), the array to be scaled.
%
%    Output, real XS(M,N), the scaled array.
%
  [ m, n ] = size ( x );
  xmin = min ( x );
  xmax = max ( x );
  xs = zeros ( m, n );

  for j = 1 : n
    if ( 0.0 < xmax(j) - xmin(j) )
      xs(1:m,j) = ( x(1:m,j) - xmin(j) ) / ( xmax(j) - xmin(j) );
    else
      xs(1:m,j) = 0.5;
    end
  end

  return
end

