%%3D matrix k
n=3; k=zeros(n) for a=1:n for b=1:n for c=1:n k(b,c,a)=c; end end end
using blkdiag could be obtained, however for a generic number of matrices n, this doesn't work.
u=blkdiag(k(:,:,1),k(:,:,2),k(:,:,3))
Best Answer