Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Take out index
Date: Wed, 24 Jun 2009 22:01:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <h1u7mu$kvs$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1245880862 21500 172.30.248.37 (24 Jun 2009 22:01:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 24 Jun 2009 22:01:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1875128
Xref: news.mathworks.com comp.soft-sys.matlab:550449


Hi 
For a problem,
A = [ 1; 2; 3; 4; 5; 6; 7 ]
A = 
  1
  2
  3
  4
  5
  6
  7

I know that I want to add 2 to each element, expect for the entries 1:2:end
i.e. I want to get a function f()
B = f(A) such that
B = 
  1
  3
  3
  6
  5
  8
  7
what is the most efficient way to do this?  Remember add 2 is just a simple example, and the vector A might be really huge