print all elements of matrix in single row

22 次查看(过去 30 天)
I have a matrix A=[1 2;3 4]; i wan to single row with all elements of A like like this
B=[1 2 3 4]
Please help me

回答(1 个)

Star Strider
Star Strider 2014-12-13
This works:
A=[1 2;3 4];
B = A(:).';

类别

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