Transforming a array of matrices into a single large matrix with these matrices on the diagonal.
Mostrar comentarios más antiguos
Hi,
I have an array of length z with different n times m matrices. Now I would like to put all these matrices on the diagonal of some large sparse matrix. If the matrices were all identical, I would simply write:
kron(speye(z,z),A)
Unfortunately, in my case they are not. So the above doesn't really work. Is there a simple elegant way to solve my problem?
Regards, Laurent
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 17 de Jul. de 2011
0 votos
3 comentarios
Laurent
el 17 de Jul. de 2011
Walter Roberson
el 17 de Jul. de 2011
What does it mean to say that you have an array that contains matrices? Does it mean that your array is a cell array? If so then,
blkdiag(V{:})
Jan
el 20 de Jul. de 2011
@Walter: BLKDIAG replies a sparse array if any input is sparse.
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!