I'm calling MATLAB Functions from Python via the MATLAB Engine for Python, but it is rather slow. The original MATLAB script runs in 30 ms on my system, whereas the python script in little over 5 seconds.
Is there a reason why? What should I do?
The python code:
import matlab.engine,time
start = time.clock()
eng = matlab.engine.start_matlab()
eng.forward
elapsed = (time.clock() - start)
print("Time used:",elapsed)
>>> 'Time used:', 4.879795798557371
The MATLAB runtime:
forward | 0.029 s | 0.015 s