Skip to content

ollie-d/sos_matlab_python_examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

SoS MATLAB x Python3 Examples

Here are the tools I'm using

  • OS: Windows 11

    • Terminal launching Miniconda3 (4.12.0)
  • Python: 3.10.4

  • pip: 22.2.2

  • MATLAB: R2022b (9.13.0.2049777 )

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 and Python and MATLAB subkernels 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:

About

Repo for showing example setup and usage of SoS kernel with Python3 and MATLAB subkernels

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published