%WEBVERSION Set version on website
%
%  OUT = WEBVERSION(VERSION,TOOLBOX,FTPSITE)
%
%Creates a file TOOLBOX_version.txt containing just the VERSION number on
%FTPSITE. FTPSITE should be created by the @FTP package andchanged to the
%proper directory.

function out = webversion(version,varargin)

[toolbox,ftpsite] = setdefaults(varargin,'prtools',[]);
if isempty(ftpsite)
  ftpsite = ftp('prtools.tudelft.nl','prlab','0iX7&b3c');
  cd(ftpsite,'httpdocs/files')
end

versionfile = fullfile(fileparts(which(mfilename)),[toolbox '_version.txt']);
fid = fopen(versionfile,'w');
fprintf(fid,['Version ' version ' ' date]);
fclose(fid);
s = mput(ftpsite,versionfile);
delete(versionfile)
if nargout > 1
  out = s;
end

