Constructing a block diagonal matrix using the contents of a cell
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Laura Proctor
am 13 Dez. 2011
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 Kommentare
Siehe auch
Kategorien
Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!