How to get the name of the computer under MATLAB?

I want to register the name of the computer where my script is running. Is it possible to get this info?

 Risposta accettata

Check this FEX submission. Or you can simply try following commands
[ret, name] = system('hostname')
name = getenv('COMPUTERNAME'); % for windows
name = getenv('HOSTNAME')

1 Commento

This does not work when running a VPN on a Mac (running Catalina); the hostname is replaced by an IP address.

Accedi per commentare.

Più risposte (1)

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

Categorie

Tag

Richiesto:

il 29 Apr 2018

Risposto:

il 18 Set 2024

Community Treasure Hunt

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

Start Hunting!

Translated by