What Takes to Wrap MATLAB function to Use From Excel?

10 次查看(过去 30 天)
I've got a MATLAB function that pulls data from an Excel spreadsheet (actually two separate ones) and then writes after processing into a third.
It does not return any values to the spreadsheets containing the data it uses and writes it in a "veritable plethora" of places scattered all around in the target.
What I'd like is for the person who is working in the one spreadsheet containing the source of most of the data to be able to call the MATLAB function to update the other without needing to run MATLAB itself--they don't have the skillset nor the license so I need to be able to wrap the needed runtime.
  7 个评论
Mario Malic
Mario Malic 2021-3-20
I apologise for tagging you here, but I think we could use your wisdom @Walter Roberson.
Walter Roberson
Walter Roberson 2021-3-20
MATLAB Compiler SDK is the appropriate toolbox for building something that can be called from Excel. Requires MATLAB Compiler license as well. I have never tried it (I do not have a Windows license for Excel)

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2021-3-20
Spreadsheet Link™ connects Excel® spreadsheet software with the MATLAB® workspace, enabling you to access the MATLAB environment from an Excel spreadsheet. With Spreadsheet Link software, you can exchange data between MATLAB and Excel, taking advantage of the familiar Excel interface while accessing the computational speed and visualization capabilities of MATLAB.
If they don't have MATLAB then you can either write your program in VBA in Excel and launch executables created by the MATLAB compiler, OR you can have the compiled standalone MATLAB app control Excel though ActiveX.
  13 个评论
Image Analyst
Image Analyst 2021-3-22
Persistents and globals do not remain somewhere in computer memory once the app exits, so they're not retained from session to session. That's why you need to store them in a small .mat file. It shouldn't be a big deal. I do it all the time, and even have other files, like splash screen images, sample data files, etc. that I ship along with my executable.
dpb
dpb 2021-3-22
I wasn't expecting them to remain in memory; just hoping was a way to get them retained in the executable data space.

请先登录,再进行评论。

更多回答(1 个)

dpb
dpb 2021-3-20
While I didn't answer my own Q?, I'll put an Answer here for any others who stumble over the thread and may be as confused as I have been.
Indeed, the solution was as simple as re-installing MingGW-w64 UNDER THE MATLAB APPS BANNER, NOT STANDALONE,
The previous standalone installation I had done years ago still worked/works with the command line tools I use routinely for code development outside MATLAB; but where it is installed wasn't anywhere the MATLAB Compiler looked.
Once reinstalled, it did build the standalone and it runs successfully -- this will be a major help going forward!!!
I've a few things to do to make it work for the actual system on the college server and to handle both semesters, but I updated the local copy here correctly so the functionality is all there!!!
Thanks for all the feedback; it did get me straightened out--the failure when I thought I had everything I needed had me confused--but I didn't find the compilation log until later to see the error and the lack of an error return in the script/batch file when the compiler isn't found is a sizable implementation gaff. I'll submit an enhancement request for that problem.

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by