from
Get computer name/hostname
by Manuel Marin
It provides the computer name where running. Useful for customizing scripts depending on the machine
|
| getComputerName()
|
function name = getComputerName()
% GETCOMPUTERNAME returns the name of the computer (hostname)
% name = getComputerName()
%
% WARN: output string is converted to lower case
%
%
% See also SYSTEM, GETENV, ISPC, ISUNIX
%
% m j m a r i n j (AT) y a h o o (DOT) e s
% (c) MJMJ/2007
%
[ret, name] = system('hostname');
if ret ~= 0,
if ispc
name = getenv('COMPUTERNAME');
else
name = getenv('HOSTNAME');
end
end
name = lower(name);
|
|
Contact us at files@mathworks.com