get_hostname

Get system host name

Syntax

   hostname = get_hostname

Arguments

output

   hostname   string; system short host name

Description

Returns system short hostname for Unix, Mac and Windows machines. This is handy if you run Matlab on different machines and a program needs to know which machine it's running on.

On Unix and Mac, it uses the system hostname -s call; if this fails, it tries the system uname -n call. On Windows machines it uses the call getenv('COMPUTERNAME'). If get_hostname fails it issues a warning and returns an empty string. If called without a return argument it prints out the name of the host name.