Constructing a block diagonal matrix using the contents of a cell
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have created a structure which contains, say, four vectors of different lengths. So, for example:
AA=[98x1 double] [20x1 double] [98x1 double] [20x1 double]
I then use these vectors to pick out certain elements of a non-full matrix A, so, for instance (A(AA{1},AA{1}).
I was looking for a quick way to create a block diagonal matrix, with the entries, (A(AA{1},AA{1}) in the entry (1,1), (A(AA{2},AA{2})in the entry (2,2), (A(AA{3},AA{3}) in the entry (3,3) and (A(AA{4},AA{4}) in the entry (4,4) (ie: on the diagonals), with zeros obviously in the other positions. Is anyone aware of the best way to achieve this? I am unsure how to `tell' Matlab the dimension of the zero's in the block matrix, which will differ on an entry-by-entry basis.
Any help would be much appreciated.
0 件のコメント
回答 (1 件)
Laura Proctor
2011 年 12 月 13 日
I'm not quite sure of your end goal, the syntax "A(AA{1},AA{1}) in the entry (1,1)" isn't clear to me.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Operating on Diagonal Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!