Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to do vectorize this simple code?
Date: Fri, 14 Nov 2008 22:35:03 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 8
Message-ID: <gfkuen$m7v$1@fred.mathworks.com>
References: <gfkstu$1id$1@fred.mathworks.com> <gfktep$9al$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
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 1226702103 22783 172.30.248.38 (14 Nov 2008 22:35:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 14 Nov 2008 22:35:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:500921


"Scott " <crazyivan84__remove__@hotmail.com> wrote in message <gfktep$9al$1@fred.mathworks.com>...
> If I understand you correctly, all you need is the diagonal. I believe this is the simplest way (at least that I'm aware of).
> 
> y(i)=diag(my_matrix(row(i),col(i)));

This is an extremely inefficient way to do it of course.

John