Path: news.mathworks.com!not-for-mail
From: "Sadik " <sadik.hava@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab logical operators
Date: Sat, 13 Mar 2010 17:12:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 31
Message-ID: <hngh15$a3b$1@fred.mathworks.com>
References: <hnfnld$7rn$1@fred.mathworks.com> <hnfuq3$1kk$1@fred.mathworks.com> <hnfvve$j9k$1@fred.mathworks.com> <hng1md$jjm$1@fred.mathworks.com>
Reply-To: "Sadik " <sadik.hava@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1268500325 10347 172.30.248.35 (13 Mar 2010 17:12:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 13 Mar 2010 17:12:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1666517
Xref: news.mathworks.com comp.soft-sys.matlab:616540

I am sorry. I got it the other way around. This should work:

Z(Z>4) = 0;

Best.


"Mario Fatafehi" <coruba9@hotmail.com> wrote in message <hng1md$jjm$1@fred.mathworks.com>...
> "Sadik " <sadik.hava@gmail.com> wrote in message <hnfvve$j9k$1@fred.mathworks.com>...
> > I guess Mario is looking for this:
> > 
> > Z(Z<5) = 0;
> > 
> > Best.
> 
> It is not right and I am trying to manipulate to get it right.
>  Z(Z<5) = 0
> 
> Z =   0     0     5     7     8     0     0     0
> > 
> > 
> > 
> > 
> > <hnfuq3$1kk$1@fred.mathworks.com>...
> > > "Mario Fatafehi" <coruba9@hotmail.com> wrote in message <hnfnld$7rn$1@fred.mathworks.com>...
> > > > Z = [1 2 5 7 8 3 0 4]
> > > > How can I obtain Z1 = [1 2 0 0 0 3 0 4] from Z using the Matlab logical operators?
> > > 
> > > index = Z<5;
> > > 
> > > Z1 = Z(index);