Skip to content

blkdiag

general · scripts/general/blkdiag.m

: b = blkdiag (a1, a2, …)

Build a block diagonal matrix from the given numeric matrices.

The result has sum of the row counts rows and sum of the column counts columns; each input occupies its own diagonal block and everything else is zero. The result is sparse if any input is. The class follows the usual concatenation rules (an integer class wins over single, which wins over double).