Embed Matlab Code into excel

조회 수: 7 (최근 30일)
Alberto B
Alberto B 2015년 9월 20일
편집: Alberto B 2015년 9월 20일

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개)

카테고리

Help CenterFile Exchange에서 Excel Add-Ins에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by