How to get the name of the computer under MATLAB?

160 ビュー (過去 30 日間)
Mr M.
Mr M. 2018 年 4 月 29 日
回答済み: scivision 2024 年 9 月 18 日
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 Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by