Excel to MATLAB spreadsheet link requiring password
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Ishaan
2025년 4월 24일
편집: Ishaan
2025년 4월 29일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!