Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: subtract vector from matrix rows without for loop
Date: Sun, 29 Nov 2009 04:54:03 +0000 (UTC)
Organization: Xoran Technologies
Lines: 7
Message-ID: <hesupb$i07$1@fred.mathworks.com>
References: <hesm3s$3sn$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 1259470443 18439 172.30.248.38 (29 Nov 2009 04:54:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 29 Nov 2009 04:54:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:588601

"Patrick Diviacco" <patrick.diviacco@gmail.com> wrote in message <hesm3s$3sn$1@fred.mathworks.com>...
> hi,
> 
> can I subtract the same vector to each row of a matrix without using a for loop ?
> thanks

For loops may be optimal (looping along the smallest dimension of the matrix), when the smallest dimension is small enough.