Fill a vector with two vectors
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Eva Maria Leal Munoz
le 24 Nov 2020
Réponse apportée : Eva Maria Leal Munoz
le 24 Nov 2020
Hello, I have two vectors, Ex: V1 = [3 8 6 7 ] and V2= [1 5 9 4 ]. With V1 and V2, I would like to create the following vector: Result = [ 8 5 6 9 7 4]. How can I do this?
Thanks in advance,
Eva
0 commentaires
Réponse acceptée
Plus de réponses (2)
Nora Khaled
le 24 Nov 2020
v1 = [3 8 6 7];
v2 = [1 5 9 4];
r=[];
for i=2:1:length(v1)
r=[r v1(i) v2(i)];
end
r
0 commentaires
Voir également
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!