Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Replacing some # of values of an array with a different array of same # of values
Date: Thu, 11 Oct 2012 00:46:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <k554sg$86i$1@newscl01ah.mathworks.com>
References: <k54qig$45d$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 1349916368 8402 172.30.248.38 (11 Oct 2012 00:46:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 11 Oct 2012 00:46:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:780393

"Nicolas " <nickbedo@yahoo.com> wrote in message <k54qig$45d$1@newscl01ah.mathworks.com>...
> temp = [1 2 3 50 1 2 3 60 1 2 3 50 1 2 3];
> I want to find all instances of '50' and '60' and replace them with alternative values.
> altern = [80 70 80];
- - - - - - - - - -
  Use logical indexing:

 temp(temp==50|temp==60) = altern;

(It will be up to you to ensure that 'altern' has the correct number of elements.)

Roger  Stafford