User`s manual

Example – Finding an Internet Protocol Address
5-67
3. Display the Hostname or IP Address
The example uses the MATLAB strcmp function to compare the input
argument to the resolved IP address. If it matches, MATLAB displays the
hostname for the internet address. If the input does not match, MATLAB
displays the IP address.
if strcmp(input,ipaddress)
disp(sprintf('Host name of %s is %s', input, hostname));
else
disp(sprintf('IP address of %s is %s', input, ipaddress));
end;
Running the Example
Here is an example of calling the resolveip function with a hostname.
resolveip ('www.mathworks.com')
IP address of www.mathworks.com is 144.212.100.10
Here is a call to the function with an IP address.
resolveip ('144.212.100.10')
Host name of 144.212.100.10 is www.mathworks.com