function  descr = new_sbj_descr(sbj_number,group,name,comment,filename)

%NEW_SBJ_DESCR -- Makes a brand new subject-descriptor structure.
%
%  descr = new_sbj_descr(sbj_number,group,name,comment,filename)
%
%  DESCR is a structure with the following fields:
%   1. sbj_number -- an integer that uniquely identifies the subject
%   2. group -- an integer that uniquely identifies the subject's group
%   3. name -- a string, e.g. 'John Smith'
%   4. comment -- arbitrary string
%   5. filename -- a string specifying the name of the data file
%   6. session -- pending session number (==length(session_log)+1)
%   7. session_log - a structure array with the following fields:
%    7a. session -- at the time of this particular run
%    7b. date -- a string returned by DATE
%    7c. trials -- number of trials completed on that session
%
%  All input arguments except SBJ_NUMBER are optional. When not supplied,
%  the necessary information is obtained interactively via INPUT.
%
%  See also FIND_SBJ_DESCR, OPEN_SBJ_DATABASE.

% Original coding by Alex Petrov, Ohio State University
% $Revision: 1.0 $  $Date: 2002/01/07 18:27 $
%
% 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

descr.sbj_number = sbj_number ;

if (nargin < 2)
   group = input(sprintf('What group is participant %d assigned to? (0) ',...
                         sbj_number)) ;
   if (isempty(group))  group = 0 ;  end    % pressed Enter alone
end
descr.group = group ;

if (nargin < 3)
   name = input(sprintf('What is the name of participant %d? ',...
                         sbj_number),'s') ;
end
descr.name = name ;

if (nargin < 4)
   c = input(sprintf('Comment (e.g. contact info) for participant %d? ',...
                     sbj_number),'s') ;
end
descr.comment = c ;

if (nargin < 5)
   dflt_name = sprintf('sbj%03d.dat',sbj_number) ;
   filename = input(sprintf('Data file name? (''%s'') ',dflt_name),'s') ;
   if (isempty(filename))  filename = dflt_name ;  end
end
descr.filename = filename ;

descr.session = 1 ;
descr.session_log = struct('session',{},'date',{},'trials',{}) ;  % empty

%--- Return DESCR
%%%%% End of file NEW_SBJ_DESCR.M
