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