Path: news.mathworks.com!not-for-mail
From: "Ulrik Nash" <uwn@sam.sdu.dk>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Finding 0's and setting to 1
Date: Sat, 3 Sep 2011 12:37:13 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <j3t71p$rl6$1@newscl01ah.mathworks.com>
References: <j3t1sm$dtk$1@newscl01ah.mathworks.com> <j3t66h$tjg$1@speranza.aioe.org>
Reply-To: "Ulrik Nash" <uwn@sam.sdu.dk>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1315053433 28326 172.30.248.47 (3 Sep 2011 12:37:13 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 3 Sep 2011 12:37:13 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2106050
Xref: news.mathworks.com comp.soft-sys.matlab:742122

"Nasser M. Abbasi" <nma@12000.org> wrote in message <j3t66h$tjg$1@speranza.aioe.org>...
> On 9/3/2011 4:09 AM, Ulrik Nash wrote:
> > Hi Everyone,
> >
> > Suppose I have a vector A:
> >
> > A = [1 0 0 1]
> >
> > and if wish to set all 0's in A to 1 to create B:
> >
> > B = [1 1 1 1]
> >
> > How can I do this?
> >
> > Regards,
> >
> > Ulrik.
> 
> EDU>> A(A==0)=1
> 

Thank you both, so simple...

> A =
> 
>       1     1     1     1
> 
> --Nasser