How to concatenate matrix row wise to get a column vector

26 次查看(过去 30 天)
I have a matrix
A = [1,2,3,4
5,6,7,8
9,10,11,12]
How do I make it into a column vector by concatenating the rows, such that I get B = [1,2,3,4,5,6,7,8,9,10,11,12]
Thanks!

采纳的回答

Image Analyst
Image Analyst 2016-11-19
Like this:
AColumnVector = reshape(A', [], 1)

更多回答(1 个)

Star Strider
Star Strider 2016-11-19
Another approach:
B = A';
B = B(:)'
B =
1 2 3 4 5 6 7 8 9 10 11 12

类别

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