function  stats = descr(data)

% DESCR -- Descriptive statistics (short version)
%
% decr(data)
% stats = descr(data)
%
% Calculates and optionally prints some basic descriptive statistics.
% DATA must be either a column vector or a matrix of columns.
%
% See also DESCRIBE, MEAN, STD, PRCTILE.

% Original coding by Alexander Petrov, Ohio State University.
% $Revision: 1.0 $  $Date: 2004/05/25 10:20 $
%
% Part of the utils toolbox version 1.1 for MATLAB version 5 and up.
% http://alexpetrov.com/softw/utils/
% Copyright (c) Alexander Petrov 1999-2006, http://alexpetrov.com
% Please read the LICENSE and NO WARRANTY statement in ../utils_license.m

[N_replic,N_vars] = size(data) ;
if (N_replic==1 & N_vars~=1)   % row vector?
  data = data' ;
  N_replic = N_vars ;
  N_vars = 1 ;
end

if (N_vars > 1)        % matrix
  stats1 = [mean(data) ; std(data) ; min(data) ; max(data)] ;
elseif (N_replic > 1)  % column vector
  stats1 = [mean(data) std(data) min(data) max(data)]' ;
else                   % scalar
  stats1 = [data 0 data data]' ;  
end

if (nargout==0)    % print requested ?
 fprintf('\n    Mean  Std.dev       Min     Max\n') ;
 fprintf(  '------------------------------------\n') ;
           %  50.000   29.300    100.00  200.00
 fprintf(  '%8.3f %8.3f   %7.2f %7.2f\n', stats1) ;
 if (N_vars > 1)   % multiple variables ==> summary might be useful          
   fprintf('------------------------------------\n') ;
   fprintf('%8.3f %8.3f   %7.2f %7.2f\n', mean(stats1')) ;
 end
else
  stats = stats1' ;
end

%% Return STATS
%%%%% End of DESCR.M
