Rate this:

x = magic(200); % This creates a matrix
save('matlabfile.mat','x') % This saves the matrix in a file named matlabfile.mat

Then in python, open file with this:

import scipy.io
f = scipy.io.loadmat('matlabfile.mat') # Imports file into a dictionary where the "key" is the matlab name of the variable (i.e. x) and the data is stored as the dictionary value
x = f["x"] # Makes the python variable "x" equal to the data associated with key "x" (in f)

First, we install Spyder (along with all the libraries that come with it)

Then, we install additional libraries (than do not come with Spyder)

Spyder is a powerful interactive development environment (IDE) for the Python language… kinda’ a graphical (Matlab-looking) interface that allows you to easily write you Python code, run it, debug it, etc. Another nice thing… when installing Spyder, it automatically installs not only Python, but also a bunch of scientific libraries like NumPy, SciPy,Matplotlib and iPhyton.

Install Spyder in Linux (Ubuntu)

Install Spyder via Ubuntu Software Centre:

Open the “Ubuntu Software Centre”

Search for “spyder”

Click install

It should be installed under the “Scientific” menu

OR install Spyder via a terminal:

sudo apt-get install spyder

Install additional libraries

Basemap

You may be apble to search for “Basemap” in the software centre and click install… if not read below:

Then, we download and install other libraries that do not come with Python(x,y).

Note: Spyder is a powerful interactive development environment (IDE) for the Python language… kinda’ a graphical (Matlab-looking) interface that allows you to easily write you Python code, run it, debug it, etc.