Constructing a block diagonal matrix using the contents of a cell
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Laura Proctor
el 13 de Dic. de 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 comentarios
Ver también
Categorías
Más información sobre Operating on Diagonal Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!