Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: construct diagonal block matrix
Date: Fri, 12 Jun 2009 21:58:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 15
Message-ID: <h0uj19$i02$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1244843881 18434 172.30.248.38 (12 Jun 2009 21:58:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 12 Jun 2009 21:58:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1875128
Xref: news.mathworks.com comp.soft-sys.matlab:547050


I want to build a diagonal matrix such as

1 2 0 0 0 0
0 0 3 4 0 0 
0 0 0 0 5 6 

with a given (arbitrary) matrix,   
1 2
3 4
5 6

without using loops and cell arrays (conversion takes time)  blkdiag works with only parameters (a,b,c,d...) a,b,c,d... are row vectors.
suggestions?

Tim