ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DDE - calling Matlab Functions (https://www.excelbanter.com/excel-programming/345759-dde-calling-matlab-functions.html)

Noel

DDE - calling Matlab Functions
 
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

Noel

DDE - calling Matlab Functions
 
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.s...ction&rnum= 7


Hope this helps...

"Noel" wrote:

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



All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com