MATLAB: How to transpose a block matrix

MATLABtranspose

Hi all,
How to transpose in a nice way a block matrix? Say that I have A = [A11 A12 A13;A21 A22 A23;A31 A32 A33], where each Aij is a n*m matrix, how to compute A'= [A11 A21 A31;A12 A22 A32;A13 A23 A33]?

Best Answer

Use cells, transpose them.
C={[1,1;1,1],[2,2;2,2];[3,3;3,3],[5,5;5,5]};
D=C';
%to get matrices out of cells
cell2mat(C)
cell2mat(D)