No BSD License  

3.16667

3.2 | 6 ratings Rate this file 20 Downloads (last 30 days) File Size: 2.81 KB File ID: #8233

Get MAC and IP Address, Network IDs

by

 

06 Aug 2005 (Updated )

This c-mex function obtains the MAC and IP addresses and IDs of the computer.

| Watch this File

File Information
Description

Obtain physical address (MAC) and IP address of the computer. Acts as an MATLAB version 'ipconfig'.

MATLAB release MATLAB 6.5 (R13)
Other requirements VC6 ++
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
04 May 2012 Feng Shengzhen

Hi Xiangrui,
use command "computer" could get the os info. Then different local command can be correctly chosen.

01 Feb 2012 Xiangrui Li

Here are a way to get MAC address for different systems:
system('getmac'); % windows
system('netstat -I en0'); % mac
system('/sbin/ifconfig eth0'); linux

-Xiangrui

29 Dec 2011 Peter

I love the speed of this function compared to the dos ipconfig solution. However, I cant seem to figure out how to store the displayed information into a variable?

I have never worked with the mex files, so trying to alter it to spit out output is too hard for me.

Would appreciate help

Peter

29 Sep 2011 Tsinghua  
15 Sep 2005 Najeeb Ahmed

this software solve my problem i am really now full relex now solve my mentally tention.
Thanxs

16 Aug 2005 Michael Kleder

Good approach if java isn't an option, such as when running matlab with "matlab -nojvm" or if a Java call isn't desired.

If Java is an option, I've had good luck with:
char(java.net.InetAddress.getLocalHost.toString)

15 Aug 2005 Marcelo Pisani

The authour does not provide instructions of how to compile / call the file in Matlab. The solution proposed here by Stephen could not get the MAC number. The solution proposed by Schwarz will fail in non-english versions of IPCONFIG.EXE.

08 Aug 2005 Stephen LL

Here is another solution for getting the IP address that should work on most computers.
MyExternalIP=regexp(urlread('http://checkip.dyndns.org'),'(\d+)(\.\d+){3}','match');

08 Aug 2005 urs (us) schwarz

a more MLbbish solution could look like this (on wintel boxes):
a=strread(evalc('!ipconfig -all'),...
'%s','delimiter','\n');
a([strmatch('IP A',a),...
strmatch('Physical',a)])

Contact us