How can I open References to "excllink.xlam" in VBA
1 view (last 30 days)
Show older comments
How can I open References to "excllink.xlam" in VBA. It belongs to a Matlab example named" Exlisamp". When I want to open it in VBA it asks for password.
0 Comments
Answers (2)
Chidvi Modala
on 8 Mar 2021
It would be helpful if you can provide more details on the reproduction steps and the exact error you are facing. A screenshot of the error can be helpful. In the meanwhile you can refer to Work with Microsoft Visual Basic Editor section in https://www.mathworks.com/help/exlink/add-in-setup-1.html. This might help
Chidvi Modala
on 8 Mar 2021
An example VBA code is the following:
Sub MyTest()
Dim m As Object
Dim output As Variant
Dim x As Long
x = 6
ReDim rors(1 To x, 1 To 1)
Set m = CreateObject("Matlab.Application")
m.Feval "randi", 1, output, 4, 1, 6
Set m = Nothing
For i = 0 To 5
rors(i + 1, 1) = output(0)(0, i)
Next i
Set wb = ActiveWorkbook
Set ws = wb.Sheets("Sheet1")
Set TxtRng = ws.Range("A1:A6")
TxtRng.Value = rors
End Sub
The routine above calls the "randi" MATLAB function.
The "1" indicates the number of outputs, "output" the variable where to store the output of the function call, and finally "4,1,6" are the inputs to the "randi" function.
The "output" variable is then copied over to "rors", and finally written to cells A1 to A6.
You can also refer to a similar question asked here
0 Comments
See Also
Categories
Find more on Data Export to MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!