⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gethostname.m

📁 Multicore - Parallel Processing on Multiple Cores
💻 M
字号:
function hostName = gethostname
%GETHOSTNAME  Get host name.
%		HOSTNAME = GETHOSTNAME returns the name of the computer that MATLAB 
%		is running on. Function should work for both Linux and Windows.
%
%		Markus Buehren
%		Last modified: 20.04.2008
%
%		See also GETUSERNAME.

persistent hostNamePersistent

if isempty(hostNamePersistent)
	if ispc
		systemCall = 'hostname';
	else
		systemCall = 'uname -n';
	end
	[status, hostName] = system(systemCall);
	if status ~= 0
		error('System call ''%s'' failed with return code %d.', systemCall, status);
end
	hostName = hostName(1:end-1);

	% save string for next function call
	hostNamePersistent = hostName;
else
	% return string computed before
	hostName = hostNamePersistent;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -