How to concatenate two matrices

I need to concatenate two matrices
x=[ 1 2 3 4]
y=[5 6 7 8]
such that I get
z=[1 5 2 6 3 7 4 8]

댓글 수: 2

Oleg Komarov
Oleg Komarov 2012년 3월 23일
Have you tried looking in the documentation for "concatenate"?
Sharon
Sharon 2012년 3월 23일
yes cat(2,x,y) gives me
ans=
1 2 3 4 5 6 7 8 and not
1 5 2 6 3 7 4 8

댓글을 달려면 로그인하십시오.

 채택된 답변

Honglei Chen
Honglei Chen 2012년 3월 23일

0 개 추천

z = [x;y];
z = z(:).'

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

태그

질문:

2012년 3월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by