How I concatenate two vectors?

조회 수: 451 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by