Polyglot MATLAB Notebooks

A repository containing examples and instructions on using Script of Script (SoS) Polyglot notebooks with MATLAB and other languages.
13 Downloads
Updated 6 May 2023

Polyglot MATLAB Notebooks using Script of Script (SoS)

A repository containing examples and instructions on using Script of Script (SoS) Polyglot notebooks with MATLAB and other languages.

Here are the tools I'm using

  • OS: Windows 11
  • git: 2.37.2.windows.2
  • MATLAB: R2022b (9.13.0.2049777 )
  • Terminal launching Miniconda3
    • Conda: 23.3.1
    • Python: 3.10.10
    • pip: 23.1.2

Installation Steps

1. Install and activate MATLAB

2. Install miniconda3 or anaconda3 (I use miniconda) and open anaconda terminal

  • Note: Run the terminal in administrator or elevated permission (depending on your OS)

3. Create an environment for MATLAB in miniconda and activate

  • conda create -n "sos" python=3.10
  • conda activate sos

4. (In MATLAB console) Point MATLAB to your conda environment

  • pyversion('C:\Users\<user>\miniconda3\envs\matlab\python.exe');
    pyenv('ExecutionMode', 'OutOfProcess');

5. Install SoS, Python and MATLAB subkernels and matplotlib (for Python) via

6. Install the MATLAB engine to Python (note that official documentation is deprecated on MathWorks and SoS websites now)

  • In conda terminal run:
python -m pip install matlabengine==9.13.7
  • To test that this worked, first activate Python in the conda terminal via:
  • python
  • Then execute the following code:
    import matlab.engine
    eng = matlab.engine.start_matlab()
    eng.isprime(37)
  • Exit Python with exit() but keep terminal open.

7. (still in conda terminal) Install matlab_kernel

  • pip install matlab_kernel

8. Confirm that the installation works by running the example/test_installation notebook and running each cell.

  • Open a Jupyter Notebook in conda terminal via:
jupyter notebook

Notes:

  1. You will need to change the ratelimit for Jupyter to visualize larger EEGLAB objects. Follow the steps here:

Cite As

Alessandro DAmico (2024). Polyglot MATLAB Notebooks (https://github.com/ollie-d/polyglot-matlab-notebooks/releases/tag/v0.0.1), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with R2022b to R2023a
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
0.0.1

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.