function readtable_test ( )

%*****************************************************************************80
%
%% READTABLE_TEST tests the MATLAB function readtable().
%
%  Discussion:
%
%    Standard MATLAB file reading functions like load() and csvread()
%    cannot read files of data in columns when some data is numeric, and
%    some is text.
%
%    The readtable() function handles this case, but creates a special
%    structure called a table, to store the data.  Individual columns
%    can be accessed using the same curly bracket indexing used for
%    cell arrays.  There are probably other wonderful features.
%
%    I'm just glad to be able to get past the failure to deal with
%    common data file formats.
%
%  Modified:
%
%    24 September 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'READTABLE_TEST\n' );
  fprintf ( 1, '  MATLAB version.\n' );
  fprintf ( 1, '  Demonstrate how the MATLAB command readtable(filename)\n' );
  fprintf ( 1, '  can be used to read a data file containing data in columns\n' );
  fprintf ( 1, '  some numeric, and some text.\n' );
%
%  Read the file.
%
  data = readtable ( 'basketball.csv' );
%
%  Column 4 is Height, Column 5 is weight.
%  Use curly braces for indexing.
%
  figure ( 1 );
  plot ( data{:,4}, data{:,5}, 'b.', 'Markersize', 30 );
  xlabel ( '<-- Height -->' );
  ylabel ( '<-- Weight -->' );
  title ( 'Height versus Weight for Basketball Players' );
  grid ( 'on' );

  filename = 'height_weight.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s".\n', filename );
%
%  Column 9 is Age, Column 6 is sponsorship earnings.
%  Use curly braces for indexing.
%
  figure ( 2 );
  plot ( data{:,9}, data{:,6}, 'b.', 'Markersize', 30 );
  xlabel ( '<-- Age -->' );
  ylabel ( '<-- Sponsorship Dollars -->' );
  title ( 'Age versus Sponsorship for Basketball Players' );
  grid ( 'on' );

  filename = 'age_sponsorship.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s".\n', filename );
%
%  Column 2 is Name, Column 6 is sponsorship earnings.
%  Use curly braces for indexing.
%
  figure ( 3 );
  barh ( data{end:-1:1,6} );
  yticks ( 1 : 30 );
  set ( gca, 'yticklabel', data{end:-1:1,2} );
  xlabel ( '<-- Sponsorship Dollars -->' );
  title ( 'Who makes the big bucks?' );
  grid ( 'on' );

  filename = 'name_sponsorship.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s".\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'READTABLE_TEST\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

