0

I'm trying to work on a eeg file which is in .mat format. And I need to convert it to a eeglab format, pop_loadset is supposed to do that. But it's not working.

I can read the file using scipy.io.loadmat(). But I don't know how to work with that format. I'm working on google colab.

matItem ='/content/drive/MyDrive/Depression Rest/Matlab Files/507_Depression_REST.mat'
matData = octave.pop_loadset(matItem)

#matData = scipy.io.loadmat(matItem)
---------------------------------------------------------------------------
Oct2PyError                               Traceback (most recent call last)
<ipython-input-88-79de92d55448> in <cell line: 2>()
      1 matItem ='/content/drive/MyDrive/Depression Rest/Matlab Files/507_Depression_REST.mat'
----> 2 matData = octave.pop_loadset(matItem)
      3 
      4 #matData = scipy.io.loadmat(matItem)

1 frames
/usr/local/lib/python3.9/dist-packages/oct2py/core.py in _exist(self, name)
    755             if "error:" in resp:
    756                 msg = 'Value "%s" does not exist in Octave workspace'
--> 757                 raise Oct2PyError(msg % name)
    758             else:
    759                 exist = 2

Oct2PyError: Value "pop_loadset" does not exist in Octave workspace`

I've tried using loadmat then convert by using mne Python. But it's not working. I'm using this dataset: pred+ct

mkrieger1
  • 19,194
  • 5
  • 54
  • 65

1 Answers1

2

This tutorial demonstrates how to use EEGLAB functions from Python: https://eeglab.org/others/EEGLAB_and_python.html#how-to-call-eeglab-functions-from-python

You are already using Oct2py, so you need to add the desired functions to Python using octave.addpath.

It looks like you should be using

octave.addpath('/data/matlab/eeglab/functions/popfunc')
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • It works thanks! But now it's giving new error Octave evaluation error: error: 'finputcheck' undefined near line 93 column 5 error: called from: pop_loadset at line 93, column 3 – Rohit Datta May 04 '23 at 13:12