Output of matrix in Excel add-in

1 view (last 30 days)
Sieghard
Sieghard on 10 Feb 2017
Another probably quite newbie-ish question: I got my Excel add-in running by using Matlab's library compiler. In the tutorials and webinars, if the output of the compiled function is a matrix, it will populate the respective number of cells. E.g., in the mymagic example, if executed in cell A1 the numbers will be displayed in the range A1:E5.
However, if I use my function
function coeff = SVPreg(xydata)
nbrMP = length(xydata(:,1));
nbrVar = length(xydata(1,:));
xdata = zeros(nbrMP,5);
xdata = xydata(:,nbrVar-4:nbrVar);
ydata = xydata(:,1:nbrVar-5);
fcn_svp = @(x,xdata)x(1)+x(2).*xdata(:,1)+...+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
in Excel cell A1, only the value of coeff(1,1) will be displayed in cell A1, and the remainder of the 6x21 matrix is nowhere to be found. Also if I select A1:F21 beforehand, only A1 will be populated. Thanks in advance for your help!

Answers (0)

Community Treasure Hunt

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

Start Hunting!