Why are some COM methods missing?

7 views (last 30 days)
M Koelemay
M Koelemay on 24 Jan 2013
I am using the Python package "comtypes" to open a Matlab COM Automation Server from Python. It seemed to be working just fine, as with the code below I was able to make a Matlab COM object, and set a string to the Matlab workspace.
from comtypes.client import CreateObject
m=CreateObject('Matlab.Desktop.Application')
m.PutCharArray('mystr','base','hello world')
The problem is that it does not let me call "execute" and does not even show "execute" as an available method for that COM object. Here is what it shows me for available methods:
| Feval = func(obj, *args, **kw)
|
| GetCharArray = func(obj, *args, **kw)
|
| GetVariable = func(obj, *args, **kw)
|
| GetWorkspaceData = func(obj, *args, **kw)
|
| MaximizeCommandWindow = func(obj, *args, **kw)
|
| PutCharArray = func(obj, *args, **kw)
|
| PutWorkspaceData = func(obj, *args, **kw)
|
| Quit = func(obj, *args, **kw)
|
| XLEval = func(obj, *args, **kw)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from comtypes.gen._C36E46AB_6A81_457B_9F91_A7719A06287F_0_1_0.DIMLApp:
|
| Visible
I am confused as to why Execute would not be an available call from this COM object; any help would be greatly appreciated.

Answers (1)

Amro
Amro on 20 May 2013
This works for me:
import win32com.client
m = win32com.client.Dispatch('matlab.application')
m.Execute("plot(rand(100,1))")
m.Quit()

Categories

Find more on Data Import and Export in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!