M-File not accessible in Excel Add-in

2 ビュー (過去 30 日間)
Sieghard
Sieghard 2017 年 1 月 11 日
回答済み: Sieghard 2017 年 2 月 10 日
Hi,
I generated an Excel Add-in using the Library Compiler with MS Win SDK 7.1 in the background. The compilation worked fine and the xla file was generated. Once imported to Excel, I called the newly programmed function =fitSVP(D4:N25). However, I received the error
Error in fitSVP.Class1.1_0: Previously accessible file "J:\Work\Research\0030-Calculations\MatlabFiles\fitSVP.m" is now inaccessible.
and the output is not generated. The path is a network drive and added to Excel as trusted location. The spelling is correct and the file is there. Any ideas how to overcome this error?
Thanks, Sieghard
  2 件のコメント
Harsheel
Harsheel 2017 年 1 月 27 日
The .xla file should not invoke non-compiled .m file. Does your compiling file have hard-coded paths to other .m files?
Sieghard
Sieghard 2017 年 2 月 3 日
編集済み: Sieghard 2017 年 2 月 3 日
No, it doesn't. It is a simple regression function programmed with the optimization tool box. The fitSVP.m file is the original file I compiled, i.e., the one where the function is in. The full fitSVP.m file looks like that:
function coeff = fitSVP(xydata)
nbrMP = length(xydata(:,1));
nbrVar = length(xydata(1,:));
xdata = xydata(:,nbrVar-4:nbrVar);
ydata = xydata(:,1:nbrVar-5);
fcn_svp = @(x,xdata)x(1)+x(2).*xdata(:,1)+x(3).*xdata(:,2)+...+x(21).*xdata(:,5).^2;
x0 = zeros(1,21);
coeff = zeros(nbrVar-5,21);
for i = 1:nbrVar-5
coeff(i,:) = lsqcurvefit(fcn_svp,x0,xdata,ydata(:,i));
end
coeff = transpose(coeff);
end
Any ideas?
Thanks!

サインインしてコメントする。

採用された回答

Friedrich
Friedrich 2017 年 2 月 9 日
Hi,
do you have a startup.m file which set up paths, CDs into something? Something messed up the search path of the compiled add in which leads to the addin trying to access a noncompiled m file.

その他の回答 (1 件)

Sieghard
Sieghard 2017 年 2 月 10 日
Thanks, that helped. I still do not quite understand why, but removing the startup.m file and copying it to the base search path did the trick. Thanks a lot!!!!

カテゴリ

Help Center および File ExchangeApplication Deployment についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by