DDE - calling Matlab Functions

G

Guest

Hi,

Does anyone know how to call and pass values to a function or sub in Matlab?
I can currently pass values directly to the workspace and execute a .m file
which references these varaibles (thus haing a similar effect) using a DDE
connection, but I can't seem to call a function as I would if I were in
Matlab itself.

I have tried the following code in VBA:

Application.DDEExecute channel, "valueSwap_vanilla(" & variable & ")"

But it doesn't work! Any suggestions...Thanks very much in advance.
Noel
 
G

Guest

Hi, I have found the solution to the problem. So just to inform anyone who
might be interested - it is possible to create a Matlab Application Object
(you'll need to reference the Matlab Library "Matlab Automation Server Type
Library" ), on which one can call the "Execute" Member Function which can be
used to call a user defined function and pass values (as strings) to it. For
example,


Set m_MatlabApp = CreateObject("Matlab.Application")
m_MatlabApp.Execute "y = value(" & a & "," & v & ")"

There is a breif discussion on the pros and cons of this method at
http://groups.google.ca/group/comp....4b43c2950d?q=excel+DDE+matlab+function&rnum=7


Hope this helps...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top