How to get the name of the computer under MATLAB?

197 views (last 30 days)
Mr M.
Mr M. on 29 Apr 2018
Commented: nan on 18 Aug 2020
I want to register the name of the computer where my script is running. Is it possible to get this info?

Answers (1)

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

Sign in to comment.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!