How I concatenate two vectors?
231 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Julen Vicente Pipaon
le 2 Mar 2021
Modifié(e) : Stephen23
le 2 Mar 2021
For example
I have these vectors
x = [1 2 3 4 5]
y = [6 7 8 9 10]
And I want to concatenate them like this:
z = [ 1 2 3 4 5 6 7 8 9 10]
0 commentaires
Réponse acceptée
Stephen23
le 2 Mar 2021
Modifié(e) : Stephen23
le 2 Mar 2021
Square brackets are the concatenation operator: you already used them to concatenate lots of scalar numbers into two vectors, now you can use them to concatenate two vectors into one vector:
x = [1,2,3,4,5];
y = [6,7,8,9,10];
z = [x,y]
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!