[Re-added pywin32 - please keep replies there]

On 25/05/2011 9:39 AM, kycbusin...@kycbusiness.com wrote:
Dear Dr. Hammond,

Thank you again.

What I have tried to do is to transmit data from Python
to Matlab, using COM OLE. Here is my code:

ml=win32com.client.Dispatch("Matlab.Application")
N=3
ml.Execute("M=N")
u"??? Undefined function or variable 'N'.\n\n"

I don't know matlab at all, but I expect you want that second line to say:

ml.Execute("N=3")

All you have done in your version is set a Python variable named 'N' to 3, not a matlab variable - so matlab is returning a string indicating the error. Python and matlab don't magically share a namespace via COM.

HTH,

Mark


ml.Execute("C=magic(3)")
u'\nC =\n\n     8     1     6\n     3     5     7\n     4     9     2\n\n'

I can only input the integer 3 explicitly inside "Execute()", but not
from Python.

You are the world's authority in COM, your help will be very much appreciated.

Sincerely,

Kin Cheung




----- Original Message -----
From: kycbusin...@kycbusiness.com
To: mhamm...@skippinet.com.au
Cc: kycbusin...@kycbusiness.com
Sent: Monday, May 23, 2011 9:34:02 PM
Subject: Re: [python-win32] OLE COM in Python

Dear Dr. Hammond,

Thank you very much for your instruction.

Sincerely,

Kin Cheung



----- Original Message -----
From: "Mark Hammond"<skippy.hamm...@gmail.com>
To: kycbusin...@kycbusiness.com
Cc: python-win32@python.org
Sent: Monday, May 23, 2011 8:47:14 PM
Subject: Re: [python-win32] OLE COM in Python

On 23/05/2011 7:59 PM, kycbusin...@kycbusiness.com wrote:
Dear sir,

I am looking for a sample python script to declare VARIANTs
similar to one shown below which is for Perl. Your help will be very
much appreciated.

win32com doesn't have a way to explicitly declare variants - you just
pass normal Python objects (eg, simple objects like ints or floats, or
lists of them) and they are converted to variants internally.

HTH,

Mark

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to