Quick Trick: Import .mat data files into Anaconda Spyder

I stumbled across a feature in Anaconda’s Spyder that I wasn’t aware of previously. (Perhaps the feature was quietly introduced in a release where I didn’t read the release notes.)

In the past when working with Matlab data files, I would use something like:

import scipy.io
mat = scipy.io.loadmat('file.mat')

It looks like it is even easier than that and it is particularly useful for data exploration where you don’t want to write code and create a script only to see what is inside a Matlab data file.

Anaconda Spyder’s data import function inside the Variable Explorer window has the option to import Matlab files with the .mat extension. A bit of a nice time saver!

Save time with Spyder's Matlab data import feature.
Save time with Spyder’s Matlab data import feature.