File Exchange Pick of the Week

Our best user submissions

Get Computer MAC Address

Posted by Sean de Wolski,

Sean‘s pick this week is Get Computer MAC Address by Xiangrui Li.

What is a MAC Address and what is it used for? I like the description in the answer to this howtogeek question.

The reason I need to know my MAC Address and Wireless MAC Address is for a written property pass to bring my laptop onto
restricted customer sites or to have my laptop authorized for internet access at customer sites.

There are commands you can run that vary by operating system which I’ve always had to search for, so Xiangrui’s file makes
this easy. His function is platform agnostic, and has a set of fallback algorithms sorted based on speed.

It’s pretty simple, you can ask for one or all MAC Addresses.

m = MACAddress
m =
    '54-E1-AD-55-55-55'

Or if you want all of them:

m = MACAddress(1)'
m =
  4×1 cell array
    {'54-E1-AD-55-55-55'}
    {'AC-ED-5C-55-55-55'}
    {'AC-ED-5C-55-55-55'}
    {'AC-ED-5C-55-55-55'}

My only feedback would be to have another option which returns a table with the RowNames indicating which MAC Address each represents.

Comments

Do you have a use for getting the MAC address within MATLAB?

Give it a try and let us know what you think here or leave a comment for Xiangrui.

Get the MATLAB code

Published with MATLAB® R2017b

Add A Comment

Your email address will not be published. Required fields are marked *

What is 3 + 7 ?

Preview: hide