File Exchange

image thumbnail

Get MAC and IP Address, Network IDs

version 1.0 (2.81 KB) by

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

6 Ratings



No License

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

Comments and Ratings (9)

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

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



Peter (view profile)

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



Najeeb Ahmed

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

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:

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.

Stephen LL

Here is another solution for getting the IP address that should work on most computers.

urs (us) schwarz

a more MLbbish solution could look like this (on wintel boxes):
a=strread(evalc('!ipconfig -all'),...
a([strmatch('IP A',a),...

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video