1function usernameOut = getusername
2%GETUSERNAME  Get user name.
3%		USERNAME = GETUSERNAME returns the login name of the current MATLAB
4%		user. Function should work for both Linux and Windows.
5%
6%		Markus Buehren
7%		Last modified 13.11.2007
8%
9%		See also GETHOSTNAME.
10
11persistent username
12
13if isempty(username)
14	if ispc
15		username = getenv('username');
16	else
17		[ignore, username] = system('whoami'); %#ok
18		username = username(1:end-1);
19	end
20end
21
22usernameOut = username;
23
24