save calculated values in a loop to export in an excel-file
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
dpb
il 15 Ott 2013
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???
Risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!