How can I create a custom excel function using matlab ?
4 次查看(过去 30 天)
显示 更早的评论
Madam/Sir,
I want to use the fuction needed only in excel platform.
Let it be considered that few cells of two or more sheets will be taken as input argument of a function. And the output will be returned in another cell.
for example
'B7' cell of sheet1, 'C8' cell of sheet2 , 'D9' cell of sheet3 will be taken as input argument of a custom function named 'mywork_function'. The output of 'mywork_function' output will release its output in 'B8' cell of sheet1.
This function named 'mywork_function' should have been written in matlab environment.
Please help.
If possible please release a video explaining this problem to my mail id sarada@iiit-bh.ac.in
回答(1 个)
Uday Pradhan
2020-10-14
Hi Sarada,
You can use Spreadsheet Link to call MATLAB functions from Microsoft Excel. Firstly, check if Spreadsheet Link is installed by running
>> license ('test','excel_link')
on your MATLAB command line. If the answer is 1, then follow the following steps else check the previous link for installation guidance.
- Open Microsoft Excel and go to “Add – ins”. If you don’t have “Spreadsheet link” in the available Add – ins section. Click on Browse.
2. In the Browse window, navigate to the Spreadsheet link add – in (this is generally available at matlabroot/toolbox/exlink). Choose the add – in file “excllink”.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/380026/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/380026/image.png)
3. Now you can call MATLAB functions from Excel. Right Click on any empty cell on your worksheet and navigate to MATLAB > MATLAB function wizard.
You can now refer to this documentation page : Find Custom MATLAB function from MATLAB function wizard in Excel to see how can we access custom functions from Excel and then for steps to execute that function please see this link. While entering input arguments to the custom function you must use the format: Sheet1!$B$6 which indicates the cell B6 in sheet 1. Similarly, use the "Optional Output Cell(s)" section in the Function arguments window to display the result in a specified cell of any sheet![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/380031/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/380031/image.png)
Hope this helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!