function plot_thermistor_histograms(fname)
% plot_thermistor_histograms  Plot histograms of calibration data for thermistor

if nargin<1, fname='thermistor_data.txt';  end   %  Default name of data file

% -- Load the data and compute summary statistics for each column
D = load(fname);
T = D(1,:);         %  Temperature values in first row
V = D(2:end,:);     %  Voltage data in columns from second row until end
Vave = mean(V);     %  Mean of data in each column
Vmed = median(V);   %  Median of data in each column
Vstd = std(V);      %  Standard deviation of each column
nc = size(V,2);     %  Number of columns in V
nprow = ceil(nc/2); %  Number of rows in the array of histograms

fprintf('\n    T(C)   mean(V) median(V) std_dev(V)\n');
for j=1:nc
  subplot(nprow,2,j);         %  Move to the next subplot
  hist(V(:,j));               %  Bin the data and plot the histogram
  ylim( [0, 40] );            %  Set the same y-axis limits in all plots
  text(min(V(:,j))+0.1, 33, sprintf('T = %-6.1f',T(j)));    %  label the subplot
  fprintf('%8.1f %8.1f %8.1f %8.2f\n',T(j),Vave(j),Vmed(j),Vstd(j));
end