Polyglot MATLAB Notebooks

A repository containing examples and instructions on using Script of Script (SoS) Polyglot notebooks with MATLAB and other languages.
13 téléchargements
Mise à jour 6 mai 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:

Citation pour cette source

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

Compatibilité avec les versions de MATLAB
Créé avec R2022b
Compatible avec les versions R2022b à R2023a
Plateformes compatibles
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
0.0.1

Pour consulter ou signaler des problèmes liés à ce module complémentaire GitHub, accédez au dépôt GitHub.
Pour consulter ou signaler des problèmes liés à ce module complémentaire GitHub, accédez au dépôt GitHub.