File Exchange Pick of the Week

Our best user submissions

Get Computer MAC Address

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 =

Or if you want all of them:

m = MACAddress(1)'
m =
  4×1 cell array

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


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.

Published with MATLAB® R2017b

  • print


要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。