Azzera filtri
Azzera filtri

How to append vector in a for loop

72 visualizzazioni (ultimi 30 giorni)
John
John il 7 Gen 2014
Commentato: Raymond MacNeil il 27 Ott 2018
Hi there,
I have a for loop that creates an 10x10 vector in each iteration. My question is how can I append each 10x10 vector underneath each other after each iteration. So that the final vector is 30x10.
Thank you for your time
for i=1:3
% Do stuff
%result is 10x10 vector A
end

Risposta accettata

Wayne King
Wayne King il 7 Gen 2014
Modificato: Wayne King il 7 Gen 2014
B = [];
for ii=1:3
A = randi(10,10); % this is the code to create the 10x10
B = [B ; A];
end
  3 Commenti
madhan ravi
madhan ravi il 13 Ott 2018
Ask a separate question @Samuel
Raymond MacNeil
Raymond MacNeil il 27 Ott 2018
Very helpful. Many thanks!

Accedi per commentare.

Più risposte (0)

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!

Translated by