Why are some COM methods missing?
조회 수: 7 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
Amro
2013년 5월 20일
This works for me:
import win32com.client
m = win32com.client.Dispatch('matlab.application')
m.Execute("plot(rand(100,1))")
m.Quit()
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Export에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!