필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Michael
Michael 2013년 10월 15일
댓글: dpb 2013년 10월 15일
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