Excel to MATLAB spreadsheet link requiring password
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I've set up the MATLAB add-in in excel by going through the normal process (selecting the $MATLABROOT$\toolbox\exlink\excllink.xlam file), but when I go to add a module under the spreadsheet link in visual basic it's asking for a password. Any idea what this password is or how I can bypass it? My goal is to define some variables from my spreadsheet in VBA and send them to MATLAB for a function calculation.
1 comentario
Respuestas (1)
Ishaan
el 24 de Abr. de 2025
Editada: Ishaan
el 29 de Abr. de 2025
I understand that you intend to define variables from the spreadsheet in VBA to send them to MATLAB for further calculations.
The password prompt you are encountering seems to be intentional to safeguard MathWork’s IP. The official MATLAB documentation for Spreadsheet Link™ (the add-in that uses excllink.xlam) does not mention or provide a password for accessing or modifying the VBA project inside the add-in.
Instead of attempting to add a new module within the protected add-in, you can create your own VBA module in your Excel workbook to interact with MATLAB. Here's how you can achieve the same results without violate your license agreement.
1. Create a new VBA Module
1. Press Alt + F11 to open VBA editor
2. In the Project Explorer, right-click on your workbook
3. Select Insert and choose Module
2. Reference the Spreadsheet Link Library
1. In the VBA Editor, go to Tools > References
2. Look for an entry named SpreadsheetLink and check the box next to it.
3. Write VBA Code to interact with MATLAB
The following script sends data from Excel to MATLAB for calculation of mean, and retrieves the result back into Excel.
Sub SendDataToMATLAB()
Dim matlab As Object
Set matlab = CreateObject("matlab.application")
Dim ExcelRange As Range
Set ExcelRange = ThisWorkbook.Sheets("Sheet1").Range("A1:A10")
matlab.PutWorkspaceData "myData", "base", ExcelRange.Value
matlab.Execute "result = mean(cell2mat(myData));"
Dim result As Variant
result = matlab.GetVariable("result", "base")
ThisWorkbook.Sheets("Sheet1").Range("B1").Value = result
End Sub
You can refer to the following guide by MathWorks for more details and examples:
0 comentarios
Ver también
Categorías
Más información sobre Data Import from MATLAB en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!