Hi all, I try to create a cell sized 20*7. when I put it in a loop, just the last row is filled and other rows remain empty! here is a general pattern of my code:

2 visualizaciones (últimos 30 días)
ProblemInstances=cell([20 7]);
for mm = i : size (MUEGFdata,1)
Assignment = MUEGFdata{mm,1};
TimeEva = MUEGFdata{mm,2};
TimeEva_G = MUEGFdata{mm,3};
ProblemInstances{mm,1} = Num_of_RT;
ProblemInstances{mm,2} = Num_of_Shltr;
ProblemInstances{mm,3} = Num_of_TP;
ProblemInstances{mm,4} = RT_TP_DB_Ind;
ProblemInstances{mm,5} = Shltr_TP_DB;
ProblemInstances{mm,6} = Shltr_TP_Ind;
ProblemInstances{mm,7} = Time_Period_DB;
end

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 25 de Abr. de 2018
Masoud - look closely at your for loop
for mm = i : size (MUEGFdata,1)
What is i initialized to? Could it already be 20 (or size(MUEGFdata,1)? Should this be replaced with 1 instead
for mm = 1 : size(MUEGFdata,1)
  1 comentario
Masoud Kavoosi
Masoud Kavoosi el 26 de Abr. de 2018
Thank you so much Geoff for you time! there you go! I was so tired and I could not see that "i" for a while. I just replace it with 1 and everything went well.

Iniciar sesión para comentar.

Más 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