How I concatenate two vectors?

465 ビュー (過去 30 日間)
Julen Vicente Pipaon
Julen Vicente Pipaon 2021 年 3 月 2 日
編集済み: Stephen23 2021 年 3 月 2 日
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]

採用された回答

Stephen23
Stephen23 2021 年 3 月 2 日
編集済み: Stephen23 2021 年 3 月 2 日
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]
z = 1×10
1 2 3 4 5 6 7 8 9 10

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by