469,306 Members | 1,901 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Connecting to an existing MATLAB COM server from python


I wanted to connect to an already existing MATLAB application from

From the MATHWORKS documentation at:


I see that to connect to an already existing MATLAB application, I
have to do the equivalent of the following Visual Basic code:

h = GetObject(, "matlab.application")

Note It is important to use the syntax shown above to connect
with an existing MATLAB automation server. Omit the first argument,
and make sure that the second argument reads exactly as shown.

My question is, how do I replicate this from python? I tried the
import win32com.client
o = win32com.client.GetObject(Class='matlab.applicatio n') Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Program_Files\Python23\Lib\site-packages\win32com\client\__init__.py",
line 71, in GetObject
return GetActiveObject(Class, clsctx)
File "C:\Program_Files\Python23\Lib\site-packages\win32com\client\__init__.py",
line 80, in GetActiveObject
dispatch = pythoncom.GetActiveObject(resultCLSID)
com_error: (-2147221021, 'Operation unavailable', None, None)

I tried searching for relevant things in Google, but couldn't find
anything close to this. I also read the docstring of
win32com.client.GetObject, but couldn't figure out the equivalent.

I already know how to start a new MATLAB COM Server. Something like
o = win32com.client.Dispatch('matlab.application')

works fine. But I specifically want to connect to an existing server.

Jul 18 '05 #1
0 1456

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.