how reshape this matrix in matlab? thx

2 次查看(过去 30 天)
I have this matrix: for example:
into:
how can I do it without using loop? can mat2cell be useful in this case?
many thanks!!
  1 个评论
Stephen23
Stephen23 2015-1-4
编辑:Stephen23 2015-1-4
Try the transpose operator: given a matrix X, then the transpose is X.'

请先登录,再进行评论。

采纳的回答

Matt J
Matt J 2015-1-4
编辑:Matt J 2015-1-4
If the 3x3 blocks are symmetric, as in your example, a simple transpose is all you need. If, more generally, they are not, however,I would recommend MAT2TILES ( Download ) as follows
C=mat2tiles(YourMatrix,[3,3]);
YourMatrixReshaped = cell2mat(C.')
  1 个评论
Stephen23
Stephen23 2015-1-4
Mathematically correct, but it probably would be still best to introduce beginners to the nonconjugate transpose: .'

请先登录,再进行评论。

更多回答(1 个)

the cyclist
the cyclist 2015-1-4
编辑:the cyclist 2015-1-4
If your original matrix is A, then transpose it:
B = A'
[This is actually the complex conjugate transpose, but assuming your matrix is real, that's OK. You can read more with "doc transpose" and "doc ctranspose".]

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by