How to concatenate two matrices

1 次查看(过去 30 天)
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
z = [x;y];
z = z(:).'

更多回答(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