MATLAB: Build a block matrix from matrices

block matrix

I am trying to build a block matrix from square diagonal matrices e.g. M{1,1},M{1,2},M{2,1}, and M{2,2} and I need to transfer them to a big matrix B such that:
B=[M{1,1} M{1,2}]
[M{2,1},M{2,2}];
each M has the same dimension.. I appreciate any help..

Best Answer

B = cell2mat(M);
provided that the M are all the same size. (It will work in some other cases as well.)
Related Question