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

1 visualización (últimos 30 días)
Michael
Michael el 15 de Oct. de 2013
Comentada: dpb el 15 de Oct. de 2013
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 comentario
dpb
dpb el 15 de Oct. de 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???

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by