Transforming a array of matrices into a single large matrix with these matrices on the diagonal.
显示 更早的评论
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
采纳的回答
更多回答(1 个)
Walter Roberson
2011-7-17
0 个投票
3 个评论
Laurent
2011-7-17
Walter Roberson
2011-7-17
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
2011-7-20
@Walter: BLKDIAG replies a sparse array if any input is sparse.
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!