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?
0 个评论
回答(2 个)
Ameer Hamza
2018-4-29
[ret, name] = system('hostname')
name = getenv('COMPUTERNAME'); % for windows
name = getenv('HOSTNAME')
1 个评论
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!