Skip to content

Instantly share code, notes, and snippets.

@mvidaldp
Created November 23, 2020 13:00
Show Gist options
  • Save mvidaldp/6cf030e64b8cb3424211912a57fc6b33 to your computer and use it in GitHub Desktop.
Save mvidaldp/6cf030e64b8cb3424211912a57fc6b33 to your computer and use it in GitHub Desktop.
How to use Matlab on Jupyter Notebooks
  1. Assuming you created a virtual environment called matlab, otherwise:
python -m venv matlab
  1. Activate the venv:
source matlab/bin/activate
  1. Assuming you have Matlab installed in your OS:
# change matlabroot for your Matlab installation path (default: `/usr/local/MATLAB/<version>`)
cd "matlabroot/extern/engines/python"
python setup.py install
  1. Install the matlab kernel python package:
pip install matlab_kernel
  1. Install your matlab kernel (otherwise it won't be seen in Jupyter):
python -m matlab_kernel install --user

Note: Tested with Matlab R2020b and Python 3.8.

Sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment