I'm trying to call a MATLAB function from python and continue with it's result in python. My script is as simple as this:
import librosa
import numpy as np
import matlab
import matlab.engine
eng = matlab.engine.start_matlab()
eng.addpath('TFDs/', '-end')
audio = librosa.chirp(0, 5000, duration=1, linear=True)
audio = matlab.double(audio.tolist())
choi_williams = eng.dtfd_nonsep(audio ,'cw',{30})
print(choi_williams)
I'm creating a linear chirp and expect to calculate it's time frequency distribution with the help of the fast_TFDs libary. The fast_TFDs folder is part of the current directory I'm executing the script from. But I'm recieving this error message:
Undefined function 'dtfd_nonsep' for input arguments of type 'cell'.
Traceback (most recent call last): File "cw.py", line 12, in choi_williams = eng.dtfd_nonsep(audio ,'cw',{30}) File "/home/dunkeljo/tmp/anaconda3/envs/keras-gpu/lib/python3.8/site-packages/matlab/engine/matlabengine.py", line 70, in call return FutureResult(self._engine(), future, nargs, _stdout, File "/home/dunkeljo/tmp/anaconda3/envs/keras-gpu/lib/python3.8/site-packages/matlab/engine/futureresult.py", line 67, in result return self.__future.result(timeout) File "/home/dunkeljo/tmp/anaconda3/envs/keras-gpu/lib/python3.8/site-packages/matlab/engine/fevalfuture.py", line 82, in result self._result = pythonengine.getFEvalResult(self._future,self._nargout, None, out=self._out, err=self._err) matlab.engine.MatlabExecutionError: Undefined function 'dtfd_nonsep' for input arguments of type 'cell'.#
So what am I doing wrong? I'm not even sure whether the issue is the input arguments or that the function cannot be found. Is the use of the function wrong? Maybe even the import of them? Or is there a problem with the input parameters? Anyone got a clue?