Skip to content

Commit

Permalink
Update EEGLAB_and_python.md
Browse files Browse the repository at this point in the history
  • Loading branch information
arnodelorme authored Dec 25, 2023
1 parent 99543ea commit e611223
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions others/EEGLAB_and_python.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ limitations if they need it for their work. By contrast, the less popular [Spyde
How to call EEGLAB functions from Python
----------------------------------------

## Using Oct2Py

If you want or need to call EEGLAB functions from Python, the best
solution is to use the Python package Oct2py (pip install Oct2py). You
will need to install Octave as well. See [this
Expand Down Expand Up @@ -166,6 +168,10 @@ import mne
EEG = mne.io.read_epochs_eeglab('eeglabfile.set')
```

## Using MATLAB runtime Engine under Python or MATLAB compiled Python library

We do not advise these solutions as EEGLAB data structures are too complex to be passed on from MATLAB to Python. When executing the Python code, you will get an error "only 1xN and Nx1 char arrays can be returned from MATLAB" (which is not technically correct as many [different data types](https://www.mathworks.com/help/matlab/matlab_external/handle-data-returned-from-matlab-to-python.html) are handled). However, the EEGLAB EEG structure contains arrays of structures for events and channels and is not handled. This has been the case for at least four years as of 2024, with no improved support in sight. Look for unsupported data types on this [page](https://www.mathworks.com/help/matlab/matlab_external/handle-data-returned-from-matlab-to-python.html) (as of 2024, the website lists "structure arrays" and "cell arrays" as unsupported data types). Note that the Oct2Py interface described above handles these data types just fine.

Will EEGLAB ever run natively on Python?
----------------------------------------

Expand Down

0 comments on commit e611223

Please sign in to comment.