Move matrix rows and columns

2 次查看(过去 30 天)
I have a n*n matrix. I want to convert it to n^2*1 matrix. for example: A=[a b;c d] result B=[a;b;c;d]

采纳的回答

Matt J
Matt J 2012-10-27
B=reshape(A.',[],1);
  2 个评论
Matt J
Matt J 2012-10-27
编辑:Matt J 2012-10-27
It would be better if you organized your a b c d data column-wise in A instead of row-wise. Then you wouldn't have to transpose A, which is expensive. Also, you could just do
B=A(:);

请先登录,再进行评论。

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