Clear Filters
Clear Filters

Running MATLAB functions in vba client through automation server

4 views (last 30 days)
Sub Main()
Dim Matlab As Object
Dim Xreal(143,1) As Double
Dim Ximag(143,1) As Double
Dim result As String
Dim i,j As Integer
Set Matlab = CreateObject("matlab.application")
MsgBox("wait for the prompt....")
Matlab.Execute("rng 'shuffle';")
Matlab.Execute("p = sobolset(2,'Skip',1e3,'Leap',1e2);")
Matlab.Execute("p = scramble(p,'MatousekAffineOwen');")
result = Matlab.Execute("X0 = net(p,144));")
Matlab.GetFullMatrix("X0","base",Xreal,Ximag)
For i = 0 To 143
For j = 0 To 1
ReportInformationToWindow(Xreal(i,j))
Next
Next
End Sub
I am running this code in order to execute MATLAB functions from VBA client. I am unable to get values from MATLAB automation server. It produces error:
Error in macro execution, please check:
(&H80020009) Exception 80020009
(Matlab.GetFullMatrix("X0","base",Xreal,Ximag))

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!