user3050521
user3050521

Reputation: 1

Running MATLAB from Python

I'm teaching myself a little bit of programming in python and also matlab. And I need to run a couple of functions I wrote in python with matlab.

I've followed the basic install instructions for pymatlab and python(x,y). When I try to create a MATLAB session with the following code:

import pymatlab
session = pymatlab.session_factory()

I get the following error:

Exception AttributeError: "'MatlabSession' object has no attribute 'engine'" in <bound method MatlabSession.__del__ of <pymatlab.matlab.MatlabSession object at 0x03654AF0>> ignored

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    session = pymatlab.session_factory()
  File "C:\Python27\lib\site-packages\pymatlab\sessionfactory.py", line 51, in session_factory
    session = MatlabSession(path=basedir,bufsize=output_buffer_size)
TypeError: __init__() got an unexpected keyword argument 'path'

Help please!

Upvotes: 0

Views: 3120

Answers (1)

samuel
samuel

Reputation: 21

It's a bug need fixed in windows platform. you can open the file "C:\Python27\lib\site-packages\pymatlab\sessionfactory.py" and locate the line 51, remove argument prefix "path="

MatlabSession(path=basedir,bufsize=output_buffer_size) 

Change into

MatlabSession(basedir,bufsize=output_buffer_size) 

Then you can enjoy your pymatlab.

Upvotes: 2

Related Questions