Matlab notebooks in Jupyther
Something really neat with Python are the iPython Notebooks, now called Jupyther. Matlab has also created its own live scripts, but you find it more suitable to use Matlab scripting within Jupyther notebooks.
Here is the How-to install instructions on Mac OS X (I have High Sierra). For Windows and Ubuntu installs, you may want to respectively look here and on there.
- First, you want to make sure that Python is installed. To do so, just run
python --versionin your Terminal. - If Python is not installed, do so by downloading and installing Anaconda. I personally installed Python 2.7
- In Matlab, run
matlabrootin the command window. This provides you the path to your matlab version. - In the terminal, run
cd "matlabroot/extern/engines/python" python setup.py install. Note that here you need to replacematlabrootby the path provided by Matlab previously on step 3. - Then, run
cdin the Terminal to go back to your home directory (where Anaconda should be installed) and run the following:
pip install pymatbridge
pip install matlab_kernel
python -m matlab_kernel install - Point the kernel to your own version of Matlab by typing in the Terminal:
echo “export MATLAB_EXECUTABLE=/Applications/MATLAB_2017b.app/bin/matlab” >> ~/.bash_profile. - Last, restart your Terminal or reload your
.bash_profile. To do so, typesource .bash_profilein the Terminal. - Your are now good to go! To use Jupyther with Matlab, just run
ipython notebookin the Terminal. A Jupyther window will open. Simply click New and select Matlab to start a new Matlab notebook.
Please do not hesitate to check the following webpages where I found most of the info, and also to add a comment.
Webliography:
• MathWorks: Install MATLAB Engine API for Python.
• Anne Urai webpage.
• Eryk Walczak blog: install on Windows and on Linux (Ubuntu).