Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: avoiding loops to built a z matrix of the most efficient form
Date: Wed, 25 Mar 2009 16:24:01 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 3
Message-ID: <gqdlr1$a49$1@fred.mathworks.com>
References: <gqdj93$qa4$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 1237998241 10377 172.30.248.38 (25 Mar 2009 16:24:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 25 Mar 2009 16:24:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com comp.soft-sys.matlab:527655

Loops have not been slow in Matlab for several releases now.  OFTEN, running a loop is going to be faster than vectorizing the code.  Not always, but it should definitely not be a surprise to find this is the case in any given situation.

Now, the real question.  Why are you so determined to solve your problem without loops?  Are you looking for a performance boost?  Do you just not like loops?  Is this a requirement for a homework assignment?