embed在matlab,Embed Matlab Code into excel

Hello,

I'm having trouble in embedding matlab code into excel. The code receives input arguments from a vba function and return the output to the same vba function.

I can create the .xla file and the related files but it seems that this method is machine dependent.

For example, if I create a simple function like this:function q = somma(w,e)

q=w+e;

end

and then I try to create an Excel AddInn through the matlab compiler it fails at the end without creating any installer. But If I use the command:mcc -W 'excel:somma,Class1,1.0' -T link:lib -b -d D:\Al\MATLAB\somma -v class{Class1:D:\Al\MATLAB\somma.m}

it creates these files:Class1_com.cpp

Class1_com.hpp

dlldata.c

mccExcludedFiles.log

mwcomtypes.h

mwcomtypes_i.c

mwcomtypes_p.c

readme.txt

requiredMCRProducts.txt

somma.bas

somma.def

somma.rc

somma.xla

somma_1_0.dll

somma_1_0.exp

somma_1_0.lib

somma_dll.cpp

somma_idl.h

somma_idl.idl

somma_idl.tlb

somma_idl_i.c

somma_idl_p.c

If I open the .xla or import .bas into my worbook the function works but it's machine dependent. If I try to add the .dll as a COM object into my workbook Excel says that "it is not a valid Office AddInn".

If instead I use this command:mcc -W 'com:somma,Class1,1.0' -T link:lib -d D:\Al\MATLAB\somma -v class{Class1:D:\Al\MATLAB\somma.m}

I get more or less the same files (not the .xla and .bas) but I have the same problem with the .dll.

Is there any way to achieve what I want? Do I have to install the MATLAB runtime? but I would like that the people that will use my Excel file, just needed it and nothing more. Is it possible?

Many thanks

AL

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值