MATLAB: How reshape this matrix in matlab? thx

mat2cellMATLABreshape

I have this matrix: for example:
into:
how can I do it without using loop? can mat2cell be useful in this case?
many thanks!!

Best Answer

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.')