function str = xbat_version(name)

% xbat_version - output XBAT version string
% -----------------------------------------
%
% str = xbat_version(name)
%
% Input:
% ------
%  name - version name
%  info - subversion info
%
% Output:
% -------
%  str - version string

%--------------------------------
% Author: Harold Figueroa
%--------------------------------
% $Revision: 6277 $
% $Date: 2006-08-22 02:30:02 -0400 (Tue, 22 Aug 2006) $
%--------------------------------

%-----------------------
% HANDLE INPUT
%-----------------------

%--
% set default name
%--

if nargin < 1
	name = 'PRE R3';
end
	
%-----------------------
% VERSION STRING
%-----------------------

%--
% get matlab version info
%--

rel = ver('matlab'); rel = rel.Version;

%--
% build version string
%--

% NOTE: this is used in figure titles and structure version fields

str = [name, ' (MATLAB ', rel, ')'];

%-----------------------
% ADD SVN INFO
%-----------------------

%--
% try to get svn info
%--

if isempty(svn_root)
	return;
end

info = get_svn_info;

if isempty(info) || ~isfield(info, 'rev')
	return;
end

%--
% create string with svn info 
%--

str = [name, '  (SVN ', int2str(info.rev), ')  (MATLAB ', rel, ')'];


