I have a .m matlab file which needs to be called from python. I tried using pymatlab 0.2.3 from https://sourceforge.net/projects/pymatlab/files/ but, while proceeding when I reached the second step
session=pymatlab.session_factory()
I encountered an error that showed " init () got an unexpected keyword argument path at line 51 of sessionfactory.py" I searched the error online and saw a solution that asked me to change line 51
session = MatlabSession(path=basedir,bufsize=output_buffer_size)
to :
session = MatlabSession(basedir,bufsize=output_buffer_size)
Even after that I could not proceed further. Can anyone help me call a .m file from python?
Try importing matlab.engine
import matlab.engine
eng = matlab.engine.start_matlab()
number_of_args_out = 0 # Number of arguments the matlab program returns
eng.your_script(nargout=number_of_args_out)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.