Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: vectorization question
Date: Mon, 13 Jun 2011 13:55:04 +0000 (UTC)
Organization: Xoran Technologies
Lines: 19
Message-ID: <it54ro$43g$1@newscl01ah.mathworks.com>
References: <it4ltl$n6p$1@newscl01ah.mathworks.com> <it53rs$q5$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1307973304 4208 172.30.248.38 (13 Jun 2011 13:55:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 13 Jun 2011 13:55:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:731671

"Matt J" wrote in message <it53rs$q5$1@newscl01ah.mathworks.com>...
>
 In fact though, it will probably be more efficient in this case to use an additional for-loop instead of BSXFUN since you only have to loop from 1 to 3:
> 
> v= N*(2*A);
> As=zeros(size(N));
> for i=1:3
>   As(:,i)=A(i)- N(:,i)*v(i);
> end
==================

Sorry, that should be

v= N*(2*A);
As=N;
for i=1:3
  As(:,i)=A(i)- N(:,i).*v;
end