How to get the name of the computer under MATLAB?

160 次查看(过去 30 天)
I want to register the name of the computer where my script is running. Is it possible to get this info?

回答(2 个)

Ameer Hamza
Ameer Hamza 2018-4-29
Check this FEX submission. Or you can simply try following commands
[ret, name] = system('hostname')
name = getenv('COMPUTERNAME'); % for windows
name = getenv('HOSTNAME')
  1 个评论
nan
nan 2020-8-18
This does not work when running a VPN on a Mac (running Catalina); the hostname is replaced by an IP address.

请先登录,再进行评论。


scivision
scivision 2024-9-18
Get the hostname of the local machine with built-in Java
name = string(java.net.InetAddress.getLocalHost().getHostName());

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by