Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Data analysis
Date: Tue, 21 Jul 2009 10:11:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <h4447l$i4a$1@fred.mathworks.com>
References: <h44342$4iu$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 1248171062 18570 172.30.248.37 (21 Jul 2009 10:11:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 21 Jul 2009 10:11:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1876948
Xref: news.mathworks.com comp.soft-sys.matlab:557061


"Jesper Lauridsen" <jesperholst_5@hotmail.com> wrote in message <h44342$4iu$1@fred.mathworks.com>...
> I have the following data in a vector called DATA1:
> 
> 0.015
> 0.01
> 0.01
> 0.01
> 0.01
> 0.005
> 0.005
> 0.005
> 0.005
> 0.005
> 0.005
> 0.005
> 0.005
> 0.005
> 
> What I want is to replace all values that are less or equal to 0.005 with zero in the vector. I was thinking to use some kind of if statement.
> 
> if DATA_1<=0.005
> ...........
> else
> ...........
> end

there can be several methods to do this depending on how you are going to use the filtered data.
try using logical indexing;
e.g; 
data = DATA_1(:,1)
zee = (data <= 0.005)

then you can set 'zee' to zero when performing a calculation..