save calculated values in a loop to export in an excel-file

1 次查看(过去 30 天)
hi,
after each iteration i want to create a vector in the loop in order to export it behind the for-loop into an excelfile. each iteration generates another ZFW value. How can i reach this ?
M = cell(28,1);
for i=1:3;
M{i} = UM(i,:);
IPV = M{i,1}(1);
IB = M{i,1}(2);
IWP = M{i,1}(3);
IK = M{i,1}(4);
IWS = M{i,1}(5);
Bundesland=2;
OptimierungPV_B_BANDU;
N(i)=ZFW;
end
xlswrite('testsheet1.xlsx', N,'Kapitalwerte');
  1 个评论
dpb
dpb 2013-10-15
Looks like you already have created the vector N -- where's the problem?
You could be slightly more efficient by preallocating N but w/ only three elements it'll not be a noticeable difference. If you make the upper index much larger it'll begin to show up.
It's certainly not clear from the snippet posted why M is allocated as 28x1 as the loop only runs to 3 but one presumes this must be just a toy sample???

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by