The following Matlab project contains the source code and Matlab examples used for get wan ip programmatically. Calling this script will get you your WAN IP. Usually when you are connected to a LAN you cannot easily/programmatically see your public IP (your IP outside your LAN). More info at: http://www.whatismyip.com/
The source code and files included in this project are listed in the project files section, please make sure whether the listed source code meet your needs there.