Effacer les filtres
Effacer les filtres

concatenate 2 matrix in loop "previous iteration"?

1 vue (au cours des 30 derniers jours)
E
E le 27 Juil 2019
Commenté : E le 27 Juil 2019
i am trying to concatenateconcatenate two matrix
the output i get same line not append previous iterations C with new C
5.0000 3.6000 1.4000 0.2000
5.0000 3.6000 1.4000 0.2000
while(i ~=4)
Datachunk(i) = next_line;
i = i + 1;
next_line = fgetl(fid);
C = cell2mat(textscan(next_line,'%f %f %f %f','Delimiter', ',','CollectOutput', true));
C4 = [C;C];
end

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 27 Juil 2019
Modifié(e) : KALYAN ACHARJYA le 27 Juil 2019
May be you replaced the privious C with current C, use copy privious C with other variable and do the same.
while(i ~=4)
Datachunk(i) = next_line;
i = i + 1;
next_line = fgetl(fid);
D=C; %privious C, do C initialization (before while loop) for 1st iteration.
C=cell2mat(textscan(next_line,'%f %f %f %f','Delimiter', ',','CollectOutput', true));
C=[D;C];
end
Hope I undestand the question, if not let me know, I will happly delete the answer.
  5 commentaires
KALYAN ACHARJYA
KALYAN ACHARJYA le 27 Juil 2019
Modifié(e) : KALYAN ACHARJYA le 27 Juil 2019
OK
C=[D;C];
E
E le 27 Juil 2019
thanks so much

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by