function gurobi_solution_read_demo ( filename )

%*****************************************************************************80
%
%% gurobi_solution_read_demo() analyzes a GUROBI solution read from a file.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    14 June 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'gurobi_solution_read_demo():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  gurobi_solution_read() reads a GUROBI solution file\n' );
  fprintf ( 1, '  This demo will read "%s"\n', filename );

  x = gurobi_solution_read ( filename );
%
%  Report the solutions.
%
  [ x_dim, x_num ] = size ( x );

  if ( x_dim <= 100 )
    i4mat_print ( x_dim, x_num, x, ' Unscrambled solution data:' );
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Data is rather large, so will not be printed out.\n' );
  end
%
%  Save X as a text file.
%
  [ filepath, name, extension ] = fileparts ( filename );
  filename2 = strcat ( name, '.txt' );

  output = fopen ( filename2, 'wt' );

  for i = 1 : x_dim
    for j = 1 : x_num
      fprintf ( output, '  %g', x(i,j) );
    end
    fprintf ( output, '\n' );
  end
  fclose ( output );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Wrote the ASCII file "%s"\n', filename2 );

  return
end
