Why are some COM methods missing?

5 visualizaciones (últimos 30 días)
M Koelemay
M Koelemay el 24 de En. de 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.

Respuestas (1)

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

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by